星空网 > 软件开发 > 操作系统

[android] 安卓自定义样式和主题

简单练习自定义样式和主题,样式是加在View上,主题是加在Application或者Activity

styles.

<??><resources ="http://schemas.android.com/apk/res/android">  <!-- 自定义样式 -->  <style name="MyFont">    <item name="android:textColor">#ff0000</item>    <item name="android:textSize">40sp</item>  </style>  <style name="MyFontSon" parent="@style/MyFont">    <item name="android:textSize">30sp</item>  </style>  <!-- 自定义主题 -->  <style name="MyTheme">    <item name='android:windowNoTitle'>true</item>    <item name="android:background">#ffffff</item>  </style></resources>

activity_main.

<??><LinearLayout ="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:orientation="vertical" >    <TextView    style="@style/MyFont"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:text="样式和主题"    />  <TextView    style="@style/MyFontSon"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:text="样式和主题"    /></LinearLayout>

Manifest.

<application    android:allowBackup="true"    android:icon="@drawable/ic_launcher"    android:label="ss"    android:theme="@style/MyTheme" >

[android] 安卓自定义样式和主题images/loading.gif' data-original="http://images2015.cnblogs.com/blog/726254/201607/726254-20160720205928122-1906583912.jpg" />




原标题:[android] 安卓自定义样式和主题

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流