zoukankan      html  css  js  c++  java
  • 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>
    
  • 相关阅读:
    linux系统用户登陆时脚本执行顺序
    stm32 win7 64位虚拟串口驱动安装失败解决办法
    python全栈day6
    python全栈day5
    江湖救急(处理域名未备案网站问题)
    python全栈day4
    python全栈day3
    python全栈day2
    python全栈day1
    PHP 跨域之header
  • 原文地址:https://www.cnblogs.com/childhooding/p/4347324.html
Copyright © 2011-2022 走看看