材料设计是Google针对Android 5.0 Lollipop引入的跨平台和设备的视觉,动作和交互设计指南。
在 Material3 中更改 ActionMode 背景颜色
从 Material3 开始,我无法更改动作模式背景颜色。 在 Material3 之前,我设法使用 actionModeBackground 属性更改背景颜色: 从 Material3 开始,我无法更改动作模式背景颜色。 在Material3之前,我设法用actionModeBackground属性改变了背景颜色: <item name="actionModeBackground">@color/some_color</item> 这是我的主题: <style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar"> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="windowActionModeOverlay">false</item> <item name="actionModeBackground">@color/action_mode_background</item> <item name="android:actionModeCloseDrawable">@drawable/ic_baseline_done_tick_24</item> </style> 我也检查了this线程但似乎不适用于material3. 如何在 Material3 上更改它? 谢谢!
MaterialDesignInXamlToolkit - 将 ListView 拉伸至全宽
我正在尝试将我的 ListView.ItemTemplate 拉伸到 ListView 的整个宽度。但是由于我使用的是 MaterialDesginInXamlToolkit,所以我尝试时我的样式会中断。 请有人帮我做我的
我正在尝试设置 Material UI Select 组件的宽度。为此,我必须为 FormControl 组件提供一个类,例如 mw-120,它链接到定义最小宽度为 12 的 CSS 类...
所以关于 Button 组件的文档有多个部分,还有一个链接在 https://codesandbox.io/s/npie4 的 Codesandbox 然而,没有提到如何改变按钮的形状......
Material 3 设计指南描述了基于内容的主题选项(而不是基于用户当前壁纸的主题)。请参阅下面的部分: https://m3.material.io/...
我的意图是将 Vue 注入 md-menu 标签(@material/web),如文档所示: 我的意图是将 Vue 注入到 md-menu 标签(@material/web)中,如文档所示: <div style="position:relative;"> <button class="anchor" ${ref(anchorRef)} @click=${() => this.menuRef.value.show()}> Click to open menu </button> <!-- `has-overflow` is required when using a submenu which overflows the menu's contents --> <md-menu has-overflow ${ref(menuRef)} ${(el) => el.anchor = anchorRef.value}> <md-menu-item header="This is a header"></md-menu-item> <md-sub-menu-item header="this is a submenu item"> <md-menu slot="submenu"> <md-menu-item header="This is an item inside a submenu"></md-menu-item> </md-menu> </md-sub-menu> </md-menu> </div> 然而 md-menu 标签没有关闭。我该怎么做才能使 HTML 正确呈现。 库链接:Github 我试过用${(el) => el.anchor = anchorRef.value}替换function (el) {el.anchor = anchorRef.value},但菜单仍然没有出现。
Lollipop 下方的 Material Design 支持 - 崩溃
我一直在尝试按照这些说明实施 Material Design 主题。 我没有使用工具栏(必须吗?) 我所有的活动都扩展了 ActionBarActivity。 使用 getSupportActionBar() 所有 ...
jetpack compose:主题颜色覆盖不适用于 api 31 及更高版本但适用于 api 30 及以下
我是 Jetpack Compose 的新手,我一直在尝试覆盖我的应用程序中的背景和表面颜色以查看效果,但它仅适用于我的 api 30 及以下虚拟设备,但不起作用...
以编程方式创建的 RippleDrawable 看起来与其对应的 xml 不同
一段时间以来,我一直在尝试追踪这个问题。我想我前段时间确实找到了解释。不幸的是,它在某处的代码注释中丢失了。 我正在尝试创建一个材质边框...
升级电鳗后如何解决Android Studio预览显示问题?
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.MainFragment"> <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="match_parent"> </com.google.android.material.card.MaterialCardView> </androidx.constraintlayout.widget.ConstraintLayout> 预览会是这样的: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.MainFragment"> </androidx.constraintlayout.widget.ConstraintLayout> 预览会是这样的: 我将 Android Studio 升级到 Electric Eel,现在,在 XML 中,预览经常无法像第一张图片那样正确显示。为什么会发生这种情况,我该如何解决?这个问题是在我升级了 Android Studio 后才出现的。 我也有这个问题,我将材料版本更改为 1.7.0 并且 Android Studio 布局渲染再次工作 我将 Material Design 库从 1.8.0 降级到 1.7.0,问题消失了。我认为问题出在新版本的 Material Design 上。 更新: 我下载了Android Studio Flamingo,问题解决了
Material Design 3 顶部应用栏没有阴影。如何启用它?
新的“Material Design 3 top app bar”文档说他们摆脱了阴影。 我怎样才能启用它?在 Toolbar 或 AppBar 上设置高度根本不起作用。
是将 bootstrep 转换为 Material Design 的任何解决方案
我需要帮助我用 html、css 和 bootstrap 设计网站,现在我的客户告诉我不想要 bootstrap 所以是否有任何将 bootstrep 转换为 Material Design 的解决方案 是将 bootstrep 转换为
Material Design 3“colorSurface”受“colorPrimary”影响
我正在尝试通过设置 colorSurface 属性(如文档中所述)来更改对话框和底部工作表的背景颜色,但是我在运行应用程序时看到的颜色是不同的...
我尝试从 themeData 更改我所有 RaisedButtons 的颜色,但它拒绝工作。所有其他属性,例如 fontSize 和 fontWeight 已成功更改。只有文字的颜色
根据可访问性指南,最小可点击区域/可触摸区域应至少为 48px * 48px。 但是在 MUI 日期选择器中,从日历弹出窗口中选择日期时,它不满足这个条件......
具有透明背景的 BottomAppBar 内的 BottomNavigationView
我一直在将新的(ish)Material BottomAppBar 与标准的 BottomNavigationView 结合起来。我的 xml 是这样的: 我一直在将新的(ish)Material BottomAppBar 与标准的 BottomNavigationView 结合起来。我的xml是这样的: <com.google.android.material.bottomappbar.BottomAppBar android:id="@+id/bottom_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" app:fabAlignmentMode="center"> <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="0dp" android:layout_marginEnd="0dp" android:background="@android:color/transparent" app:itemTextAppearanceActive="@style/AppTheme.Text.BottomNavText.Active" app:itemTextAppearanceInactive="@style/AppTheme.Text.BottomNavText" app:labelVisibilityMode="labeled" app:menu="@menu/bottom_nav_menu" /> </com.google.android.material.bottomappbar.BottomAppBar> 在以前的版本 - 1.0.0 - 这工作正常,我仍然可以按预期看到 FAB 插图。唯一的小缺点是这个版本的材质组件库没有对底部应用栏的高度效果进行排序,所以栏和上面的内容之间的区别不是很清楚。 当我升级到最新的库时,我相信在撰写本文时是implementation 'com.google.android.material:material:1.1.0-alpha09',我得到了 BottomAppBar 提升效果,但是当我将透明背景应用于 BottomNavigationView 时,我得到了一个非常奇怪的视觉效果,对于我的生活我无法理解。 如果我去掉透明背景色,效果就没有了,但是我失去了 FAB 插图,如下所示: 如果我完全删除底部导航视图子项,而只有 BottomAppBar,我会看到正常的视觉效果,但没有我的导航: 我喜欢: - 一个很好的解决方案,将底部导航视图合并到 BottomAppBar 中,同时保留 1.1.0 版库良好的提升效果,并且在其中有效地包含 BottomNavigationView,因此我保留了该导航组件的所有优点 - 或者解释到底是什么导致了这种奇特的第一海拔效应,最好是解决它的方法 好吧,这个和BottomAppBar没关系。。。后台问题发生在BottomNavigationView不管在什么地方,素材库1.1.0- .... 这是(我认为)最新版本的 BottomNavigationView 的一个错误,如果背景为 null 或 ColorDrawable,它将设置一个可着色的MaterialShapeDrawableBackground 作为其背景...并且当您在 xml 中设置颜色时,它将 是一个 ColorDrawable(包括透明)。这是 BottomNavigationView 代码中的问题: if (getBackground() == null || getBackground() instanceof ColorDrawable) { // Add a MaterialShapeDrawable as background that supports tinting in every API level. ViewCompat.setBackground(this, createMaterialShapeDrawableBackground(context)); } 这一定是你在上面看到的随机阴影形状。 解决方案 解决方法是在 xml 中设置既不是 null 也不是 ColorDrawable 的背景。我创建了自己的 drawable,它只是一个透明的矩形,并将其设置为 BottomNavigationView 背景,它就可以工作了。 background_transparent.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:padding="10dp" android:shape="rectangle" > <solid android:color="#00000000" /> </shape> 现在更新的 BottomNavigationView xml: <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bottom_navigation" style="@style/BottomNav" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="0dp" android:layout_marginEnd="0dp" android:background="@drawable/background_transparent" app:itemTextAppearanceActive="@style/AppTheme.Text.BottomNavText.Active" app:itemTextAppearanceInactive="@style/AppTheme.Text.BottomNavText" app:labelVisibilityMode="labeled" app:menu="@menu/bottom_nav_menu" /> 结果: 我遇到了同样的问题,对我来说最简单的一行修复是将 outlineSpotShadowColor 更改为透明。 解决方案... 在您的 xml 文件中,将其添加到 BottomNavigationView outlineSpotShadowColor = "@android:color/transparent" 完整的例子:- <com.google.android.material.bottomnavigation.BottomNavigationView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/bottomNavigationView" android:layout_marginEnd="20dp" app:labelVisibilityMode="labeled" android:background="@android:color/transparent" android:outlineSpotShadowColor="@color/zxing_transparent" app:menu="@menu/bottom_menu"/>
如何使布局可组合在 jetpack compose 中具有透明背景
大家好,我正在使用 Layout 可组合项来实现动画抽屉,但是每当我将 Layout 的背景设置为透明时,它就会变成黑色,但如果我提供其他颜色,它们就是
在我的应用程序中有多个页面/路由。每个实现页面的小部件在构建方法的根部都有一个脚手架(这在 Flutter 中是习惯的)。 在某些路线上我想隐藏或更改
我的网络奇才们! 我,一个谦虚的 Web 开发人员,着手改进我的个人简历网站,该网站使用 resctjs、animejs、JavaScript、CSS 和 HTML 的强大功能构建。 当我试图磨练我的
我有一个普通的 Android 应用程序,无法理解为什么我的全局样式定义没有应用于视图元素。 这是我的文件 res/values/styles.xml: <question vote="0"> <p>我有一个普通的 Android 应用程序,无法理解,为什么我的全局样式定义没有应用于视图元素。</p> <p>这是我的文件<pre><code>res/values/styles.xml</code></pre>:</p> <pre><code><resources> <style name="Theme.XXXXX" parent="Theme.MaterialComponents"> <item name="android:textAppearance">@style/Theme.XXXXX.TextAppearance</item> </style> <style name="Theme.XXXXX.TextAppearance" parent="TextAppearance.MaterialComponents.Body1"> <item name="android:textSize">24sp</item> </style> </resources> </code></pre> <p>这是我在清单中全局设置样式的地方:</p> <pre><code><application android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.XXXXX"> </code></pre> <p>这是一个琐碎的活动布局:</p> <p></p> <pre><code><LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="@dimen/dialog_padding"> <TextView android:id="@+id/introduction_overview" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/introduction_overview" /> <LinearLayout android:id="@+id/introduction_usage" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> </code></pre> <p>我的期望是TextView“@+id/introduction_overview”继承样式定义中定义的字体大小。然而,情况并非如此。为什么不呢?<em> </em>在我测试时,我将显式样式</p><code>android:textAppearance="@style/Theme.XXXXX.TextAppearance"</code><p>添加到<pre><code>TextView</code></pre>。行得通,字体大小确实得到了应用。但我不想为我所有的视图元素设置单独的样式!这就是全局样式定义的目的!<pre> </pre>我看不出在哪里可以覆盖我自己的样式定义。或其他样式定义的任何显式应用。这是一个简单的应用程序。</p> <p>有谁知道我可能会检查什么,我可能需要更改什么?</p> <p> </p></question>