码迷,mamicode.com
首页 > 移动开发 > 详细

android94 样式和主题

时间:2015-11-12 07:45:32      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:

style.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppBaseTheme" parent="android:Theme.Light">
    </style>

    <style name="AppTheme" parent="AppBaseTheme">   <!-- 主题AppTheme继承AppBaseTheme -->
    </style>

    <style name="jiangnanstyle">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textSize">22sp</item>
        <item name="android:textColor">#00ff00</item>
    </style>
    
    <style name="pangzhi" parent="jiangnanstyle">
        <item name="android:textSize">30sp</item>
    </style>
    
    <style name="pangzhi.lizhi" >   <!-- style名字是lizhi继承pangzhi -->
        <item name="android:textColor">#0000ff</item>
    </style>
    
    <style name="myTheme">
        <item name="android:background">#ff0000</item>
    </style>
</resources>

activity_main.xml

<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: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=".MainActivity" 
    android:orientation="vertical"
    >

    <TextView
        android:text="@string/hello_world" 
           style="@style/jiangnanstyle"
        />
    <TextView
        android:text="@string/hello_world" 
           style="@style/pangzhi"
        />
    <TextView
        android:text="@string/hello_world" 
           style="@style/pangzhi.lizhi"        
        />            <!-- lizhi继承pangzhi -->
    <TextView
        android:text="@string/hello_world" 
           style="@style/jiangnanstyle"
        />
    <TextView
        android:text="@string/hello_world" 
           style="@style/jiangnanstyle"
        />

</LinearLayout>

 国际化是通过系统选择不同的国家后再加载不同的语言和图片。

android94 样式和主题

标签:

原文地址:http://www.cnblogs.com/yaowen/p/4957881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!