• android简单的样式和主题


    android的样式:

    在xml文件中定义Textview的样式:

    <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:orientation="vertical"
        >
    
        <TextView
           style="@style/text_content_style"
           android:text="你好啊"
            />
         <TextView
             style="@style/text_content_style"
           android:text="你好啊"
            />
          <TextView
             style="@style/text_content_style"
           android:text="你好啊"
            /> 
            <TextView
              style="@style/text_content_style"
           android:text="你好啊"
            />
    
    </LinearLayout>
    

     android中style文件写在res/values/styles.xml中:

     <style name="text_content_style">
            <item name="android:layout_width">wrap_content</item>
            <item name="android:layout_height">wrap_content</item>
            <item name="android:textSize">25sp</item>
            <item name="android:textColor">#00ff00</item>
        </style>
    

    android的主题:

     android中style文件写在res/values/styles.xml中:

    <style name="app_theme">
            <item name="android:background">#0000ff</item>
        </style>
    

    作用在的Manifest中的Activity中和Application中:

    <application
             android:theme="@style/app_theme"
            android:allowBackup="true"
            android:label="@string/app_name"
             >
            <activity
                android:theme="@style/app_theme"
                android:name="com.example.styletheme.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
  • 相关阅读:
    响应式开发
    css3的2D和3D的转换
    前端CSS3笔记
    DOM精简版笔记
    JS进阶
    linux 修改时间同步到BIOS
    linux-设置代理和取消代理
    linux-rpm强制安装跳过依赖包
    [linux] VNC the connection was refused by the computer
    Linux vim 常用命令(不定时update)
  • 原文地址:https://www.cnblogs.com/childhooding/p/4347324.html
Copyright © 2020-2023  润新知