android 中theme.xml与style.xml的区别
16lz
2022-05-18
android 中theme.xml与style.xml的区别:
相同点:
两者的定义相同。
- <resources>
- <stylename="theme"parent="android:Theme.Black">
- <itemname="android:windowNoTitle">true< /item>
- <itemname="android:textSize">14sp< /item>
- <itemname="android:textColor">#FFFF0000< /item>
- < /style>
- < /resources>
不同点:
一、使用的地方不同
1.theme.xml:对整个应用或某个Activity存在全局性影响。
AndroidManifest.xml中:
,
,
application 和 activity java中:setTheme(R.style.theme);
2 style.xml:用在单独的View。
android:text="EditText"
style="@style/Title"
android:layout_width="fill_parent"
android:id="@+id/editText1">
二、 在R.attr定义中以window开头的一些属性只对theme有效。
三、如果一个应用使用了theme,同时应用下的view也使用了style,那么当theme与样式style发生冲突时,style的优先级高于主题。
更多相关文章
- Android中获取系统上安装的APP信息
- Android(安卓)ServiceManager注册自定义service
- :Android核心模块及相关技术
- Android(安卓)user defined service handling
- 【Android】Android清除本地数据缓存代码
- 35 个你必看的 Android(安卓)库
- Android中ImageButton自定义按钮的按下效果的代码实现方法,附网上
- android.intent.action.MAIN 与 android.intent.category.LAUNCH
- [Android]自定义弹幕View