android94 样式和主题

简介:

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>
复制代码

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



本文转自农夫山泉别墅博客园博客,原文链接:http://www.cnblogs.com/yaowen/p/4957881.html,如需转载请自行联系原作者


相关文章
|
3月前
|
Android开发 开发者
Android UI设计: 请解释Activity的Theme是什么,如何更改应用程序的主题?
Android UI设计: 请解释Activity的Theme是什么,如何更改应用程序的主题?
42 1
|
Android开发
Android 自带的字体库、字体样式
Android 自带的字体库、字体样式
1079 0
Android 自带的字体库、字体样式
|
8月前
|
前端开发 Android开发
前端项目实战壹-安卓4.4/6.0无法安装非原生项目无法渲染样式
前端项目实战壹-安卓4.4/6.0无法安装非原生项目无法渲染样式
47 0
|
9月前
|
XML Java Android开发
|
9月前
|
API Android开发 UED
|
9月前
|
XML Android开发 数据格式
|
9月前
|
XML 编解码 API
|
9月前
|
编解码 Android开发
|
9月前
|
XML API Android开发
|
9月前
|
XML 前端开发 Android开发