Android Style样式的定义

指定样式:style="@style/DavidStyleText1"

<TextView
  style="@style/DavidStyleText1"
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
  android:gravity="center_vertical|center_horizontal" 
  android:text="@string/str_text_view1"
  />


样式定义:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="DavidStyleText1">
    <item name="android:textSize">18sp</item>
    <item name="android:textColor">#EC9237</item>
  </style>
  <style name="DavidStyleText2">
    <item name="android:textSize">14sp</item>
    <item name="android:textColor">#FF7F7C</item>
    <item name="android:fromAlpha">0.0</item>
    <item name="android:toAlpha">0.0</item>
  </style>
</resources>

你可能感兴趣的:(java,android,xml)