简单说类似与自定义控件,只不过自定义控件针对的是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(安卓)对话框【Dialog】去除白色边框代码
  2. 王道Java全栈工程师培养计划
  3. Android(安卓)控件之DatePicker,TimePicker,Calender
  4. Android(安卓)Fragment的简单应用
  5. android中checkbox自定义样式
  6. Android复习(八)
  7. Android中自定义带图标和清空内容按钮的EditText控件
  8. Android(安卓)高级控件ExpandabledListView详解
  9. Android(安卓)Studio 设置控件和颜色透明度

随机推荐

  1. 【Android】@+id与@id的区别
  2. Android 动画具体解释View动画
  3. [Android]直接使用代码建立Android视图元
  4. Android基本命令
  5. Android 自定义组合控件小结
  6. Text To Speech 总结
  7. 混合开发:Android的WebView加载H5,和H5的
  8. Android8.0 图形引擎的心跳 - Vsync信号
  9. 濡備綍鐞嗚В銆佷娇鐢ˋndroid LogCat浠
  10. Android深入浅出自定义控件(一)