zoukankan      html  css  js  c++  java
  • 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>

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

  • 相关阅读:
    MongoDB学习(1)—在Windows系统中安装MongoDB
    在windows系统的文件右键菜单中增加“命令提示符”
    python基础五之字典
    python基础四之列表
    python基础三之字符串
    python基础二
    python基础一
    二叉搜索树与双向链表
    记录一下Comparator的用法
    根节点到叶子节点路径之和为target
  • 原文地址:https://www.cnblogs.com/yaowen/p/4957881.html
Copyright © 2011-2022 走看看