- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我最近将应用中的 AlertDialog
实例切换为使用 android.support.v7.app.AlertDialog
,但在应用自定义主题时遇到了问题,并且警报对话框的样式。
在我的 styles.xml 中,我有以下样式:
<style name="AlertDialog" parent="Theme.AppCompat.Dialog.Alert">
<item name="colorAccent">@color/theme_accent_1</item>
<item name="background">@color/theme_component_background</item>
<item name="android:background">@color/theme_component_background</item>
</style>
在我的 themes.xml 中,我根据需要在我的主题中设置了以下内容:
<item name="android:alertDialogTheme">@style/AlertDialog</item>
由于某些原因,自定义样式从未应用于 AlertDialog
实例,它们仍然是默认的 Theme.AppCompat.Dialog.Alert
主题。
如果我明确设置要使用的样式资源如下,它确实有效:
AlertDialog.Builder builder =
new AlertDialog.Builder(getActivity(), R.style.AlertDialog);
有没有办法在整个主题中设置默认样式,而不必在 Builder
构造函数中指定主题?
最佳答案
根据 Pankaj Kumar 的回复,该链接详细说明了解决方案,即在名称属性中包含和不包含“android:”前缀的声明。
<item name="android:alertDialogTheme">@style/AlertDialog</item>
<item name="alertDialogTheme">@style/AlertDialog</item>
关于android - 使用 android.support.v7.app.AlertDialog 自定义默认的 Theme.AppCompat.Dialog.Alert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30522082/
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想要改善这个问题吗?更新问题,以便将其作为on-topi
我正在使用自定义主题,代码如下:- 自定义样式.xml #FFFFFF 40dp @style/CustomWindowTitleBackground
我正在尝试将不同的 html(主题)应用到我的首页 (index.html),而我的所有其他页面都将具有相同的主题 (index_in.html)。我正在尝试这种方式,并想知道为什么它不起作用: 摘自
如何准确地、一步一步地安装夹层主题? 例如,Moderna free theme . 最佳答案 先决条件: 0) 版本控制 Python 2.7.6. Django 1.6.10 Mezzanine
使用 gatsby-plugin-theme-ui 构建 Gatsby 主题时,文档指出您可以通过将其添加到嵌套颜色对象中的主题对象来调整主体的背景颜色。这似乎没有效果。字体和样式等其他变量正确引入,
使用 gatsby-plugin-theme-ui 构建 Gatsby 主题时,文档指出您可以通过将其添加到嵌套颜色对象中的主题对象来调整主体的背景颜色。这似乎没有效果。字体和样式等其他变量正确引入,
我使用“@android:style/Theme.Holo”作为我的游戏主题: 但是为了能够设置 snackbar 小部件,我别无选择,只能使用“@style/Theme.AppCompat”,否则我
我使用这些说明通过 zopeskel 创建了一个新主题 http://docs.plone.org/adapt-and-extend/theming/theme_product_with_diazo.
我正在为我的工具栏使用当前的样式和主题,并使用一个支持库。我正在扩展 AppCompatActivity 而不是正常 Activity 。 false true
我用了但是 Theme.Holo 不起作用。 Android list : 截图: 最佳答案 根据documentation ,您引用的主题不存在。 在这种情况下,它被称为Theme_Holo_No
我正在尝试发布一个 github 博客页面,两个月前我可以毫无问题地将其发布到 github.io 页面,但现在抛出错误。我仍然可以在本地成功构建 jekyll 主题。 但是,当我将其推送到 gith
我最近使用 Android Asset Studio 为应用程序生成自定义操作栏主题,当我将所有内容放入我的项目时,应用程序崩溃并出现以下异常: java.lang.IllegalStateExcep
在较新版本的 Android Studio 中 在 values 目录中有 theme.xml 和 theme.xml(night) 可以指出它们之间的区别吗? 它会取代styles.xml 吗? 最
我想在 Atom 编辑器中为我的不同项目提供多个 UI 主题和语法主题,即每个打开的窗口都有一个主题,我该如何做到这一点?目前,更改首选项中的一项将会更改所有打开的窗口。 我安装了项目管理器插件,并尝
我只是为了安装magento 2.1.i迁移我的数据库感谢magento提供的工具。它工作得很好! 但是问题是,当我运行前端时,我收到此错误:无法通过指定的键加载主题:'pure' 当我想在管理中更改
我不喜欢 CustomTheme 的外观,我想保留 AppTheme。 但是当我将自定义标题栏与 AppTheme 一起使用时,它崩溃了,告诉我我无法组合多种样式。 我该怎么做? 谢谢! 最佳答案 首
我正在记录这个警告: I/AppCompatViewInflater:app:theme 现已弃用。请改为使用 android:theme。 奇怪的是,我使用了 Android Studio 的 Fi
我有一个“轻”主题的应用程序: @color/primary @color/primary_dark @color/accent 我希望我的 Toolbar 是深
我在 list 文件中声明我的 Activity ,如下所示。 我声明了全
这个问题在这里已经有了答案: You need to use a Theme.AppCompat theme (or descendant) with this activity (63 个答案)
我是一名优秀的程序员,十分优秀!