zoukankan      html  css  js  c++  java
  • Android自定义样式

    1、AndroidManifest.xml

    android:theme="@style/Theme.CustomDialog

    样式要用:@style

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.fish.helloworld"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk
            android:minSdkVersion="17"
            android:targetSdkVersion="17" />
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/Theme.CustomDialog" >
            <activity
                android:name=".MainActivity"
                android:label="@string/title_activity_receive" >
                 <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>

    2、styles.xml

    <resources>
    
        <!--
            Base application theme, dependent on API level. This theme is replaced
            by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
        -->
        <style name="AppBaseTheme" parent="android:Theme.Light">
            <!--
                Theme customizations available in newer API levels can go in
                res/values-vXX/styles.xml, while customizations related to
                backward-compatibility can go here.
            -->
        </style>
    
        <!-- Application theme. -->
        <style name="AppTheme" parent="AppBaseTheme">
            <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        </style>
        
        <style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
            <item name="android:windowBackground">@drawable/filled_box</item>
        </style>
    
    </resources>


    3、filled_box.xml

    一定放在drawable文件夹下,否在不识别

    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="#ffff8080" />
        <stroke android:width="3dp" color="#ffff8080" />
        <corners android:radius="3dp" />
        <padding android:left="10dp" android:top="10dp"
            android:right="10dp" android:bottom="10dp" />
    </shape>
  • 相关阅读:
    pet shop 案例(转)
    用我账号的哥们 别随意留言 谢谢 这个账号有特殊意义
    关于if else 和 switch 的区别 究竟哪个更快
    sql server 2008 保存表的设置
    shell编程
    敏捷项目管理
    日常起居六忌是什么?
    质量管理的几个陌生词汇
    阿里巴巴一名员工的辞职信
    什么是SaaS?
  • 原文地址:https://www.cnblogs.com/sshoub/p/3888749.html
Copyright © 2011-2022 走看看