style和theme小用法
16lz
2021-01-23
新建一个项目
main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" ><TextView style="@style/submaxhis" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /></LinearLayout>
style.xml
<?xml version="1.0" encoding="utf-8"?><resources><!-- 第一个样式 --><style name="maxhis"> <!-- 为样式定义一个全局唯一的名字--><item name="android:textSize">18px</item> <!-- name属性的值为使用了该样式的View控件的属性 --><item name="android:textColor">#0000CC</item></style><!-- 继承第一个样式 --><style name="submaxhis" parent="@style/maxhis"><item name="android:textColor">#FF0000</item></style><!-- 第一个主题 --><style name="maxhisTheme"><item name="android:windowNoTitle">true</item> <!-- 没标题 --> <item name="android:windowFullscreen">?android:windowNoTitle</item> <!-- 全屏显示 --></style></resources>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.buke.demo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name="SplashActivity" android:label="@string/app_name" android:theme="@style/maxhisTheme" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
更多相关文章
- ListView的一些属性设置
- (收集)ListView中常用属性
- Android控件属性大全[整理]
- Android Layout_weight 属性
- Android 自定义CheckBox 样式
- 关于CoordinatorLayout展开与折叠相关属性
- EditText常用属性
- android 修改actionbar title文字颜色等属性