`
zhouxiaoli521
  • 浏览: 554285 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

如何使用style

XML 
阅读更多
For example, by using a style, you can take this layout XML:

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textColor="#00FF00"
    android:typeface="monospace"
    android:text="@string/hello" />

And turn it into this:

<TextView
    style="@style/CodeFont"
    android:text="@string/hello" />


style定义
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CodeFont" parent="@android:style/TextAppearance.Medium">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#00FF00</item>
        <item name="android:typeface">monospace</item>
    </style>
</resources>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics