![](/img/trans.png)
[英]How to style PopupMenu and AlertDialog with theme.xml and style.xml
[英]Difference between style.xml and theme.xml android studio?
嘿,我正在尝试更改操作栏的背景,但我不确定我是否理解样式文件的结构。 所以基本上我有style.xml,它将一些元素传递给所需的样式。 那么我的Theme.xml里面有一组样式,对吗? 如何将两者联系起来,换句话说,如何告诉主题我想要指定的样式呢? 我无法改变操作栏的背景,所以这是我的代码:
style.xml:
<!-- Base application theme. -->
<style name="MyActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:colorBackground">@color/color_lightBlue</item>
</style>
</resources>
theme.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyCustomTheme" parent="Theme.AppCompat.Light">
</style>
</resources>
和wtf是v11 /风格?
无论是将属性放在styles.xml
还是theme.xml
,如果将主题应用于应用或活动,它们最终会产生相同的效果。 在AndroidManifest.xml
,为了让主题具有您想要的效果,您应该将自定义主题应用于您的应用。
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.