您的位置:首页 > 移动开发 > Android开发

Android - style

2016-03-01 10:49 295 查看
Style(风格):自定义的一些 View 属性集合。

styles.xml

<span style="font-size:14px;"> <style name="TextViewStyle">
<item name="android:textColor">@android:color/holo_blue_dark</item>
<item name="android:textSize">30sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:gravity">center_horizontal</item>
</style></span>

activity_main.xml

<span style="font-size:14px;"><LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello_world!" />
<TextView
style="@style/TextViewStyle"
android:text="TV1" />
<TextView
style="@style/TextViewStyle"
android:text="TV2" />
<TextView
android:text="TV1"
android:textColor="#ffffff"
android:textSize="15sp"
android:background="#ff00ff"
style="@style/TextViewStyle" />

</LinearLayout></span>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: