简单说类似与自定义控件,只不过自定义控件针对的是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>
复制代码

更多相关文章

  1. android典型代码系列(二十八)------通话记录的操作
  2. 【Android】Android清除本地数据缓存代码
  3. android中checkbox自定义样式
  4. CyanogenMod开源代码
  5. Android Studio 设置控件和颜色透明度

随机推荐

  1. Android Ant更新项目
  2. 系出名门Android(8) - 控件(View)之TextS
  3. android中 google map计算两GPS点间距离
  4. Android实现TextView字符串波浪式跳动
  5. 页面未随软键盘上升及android隐藏软键盘
  6. Android异步更新UI-线程池-Future-Handle
  7. Android(安卓)wifi设计原理(源码分析)
  8. Android应用模块基本配置元素
  9. java.lang.NoClassDefFoundError错误解决
  10. Android UEventObserver