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

Android入门--style.xml设置和应用

2016-06-12 19:22 260 查看
在res/values中添加style.xml文件,如下:

<resources>

<style name="myStyle_Text1">
<item name="android:textSize">25sp</item>
<item name="android:textColor">#80FF00</item>
</style>
<style name="myStyle_Text2">
<item name="android:textSize">18sp</item>
<item name="android:textColor">#0C688E</item>
<item name="android:fromAlpha">0.0</item>
<item name="android:toAlpha" >0.0</item>
</style>

</resources>
activity_forwarding.xml文件代码如下:

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.forwarding.Forwarding" >

<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/Btn01" />

<TextView
android:id="@+id/textView1"
style="@style/myStyle_Text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:layout_marginTop="20dp"
android:text="@string/Texts"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/textView2"
style="@style/myStyle_Text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_marginTop="20dp"
android:text="@string/Texts"
android:textAppearance="?android:attr/textAppearanceLarge" />

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