android样式跟主题
16lz
2022-03-07
简单说类似与自定义控件,只不过自定义控件针对的是view 而样式与主题针对的是属性、元素
在TexvView中引入样式
layout.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView style="@style/text_content_style" android:text="haha" /> <TextView style="@style/text_content_style" android:text="gaga" /> <TextView style="@style/text_red_content_style" android:text="guagua" /></LinearLayout>
引入的样式的.xml
<?xml version="1.0" encoding="utf-8"?><resources> <style name="text_content_style"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:textColor">#66ff00</item> <item name="android:textSize">28sp</item> </style> <style name="text_red_content_style" parent="@style/text_content_style"> <item name="android:textColor">#ff0000</item> </style> <style name="activity_bg_theme"> <item name="android:background">#ff0000</item> <item name="android:windowFullscreen">true</item> </style> </resources>
更多相关文章
- Android(安卓)对话框【Dialog】去除白色边框代码
- 王道Java全栈工程师培养计划
- Android(安卓)控件之DatePicker,TimePicker,Calender
- Android(安卓)Fragment的简单应用
- android中checkbox自定义样式
- Android复习(八)
- Android中自定义带图标和清空内容按钮的EditText控件
- Android(安卓)高级控件ExpandabledListView详解
- Android(安卓)Studio 设置控件和颜色透明度