首页 > 移动平台 > 详细

android94 样式和主题

时间:2015-11-12 07:43:58      阅读:300      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!