您的位置:首页 > 移动开发 > Android开发

apidemo 学习 android 实现透明activity

2013-04-17 15:41 351 查看
<activity
            android:name=".app.TranslucentActivity"
            android:label="@string/activity_translucent"
            android:theme="@style/Theme.Translucent" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.SAMPLE_CODE" />
            </intent-filter>
        </activity>
<!-- A theme that has a translucent background.  Here we explicitly specify
         that this theme is to inherit from the system's translucent theme,
         which sets up various attributes correctly. -->
    <style name="Theme.Translucent" parent="android:style/Theme.Translucent">
        <item name="android:windowBackground">@drawable/translucent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>


<?xml version="1.0" encoding="utf-8"?>

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_vertical|center_horizontal"
    android:text="@string/translucent_background" />


背景是壁纸的activity

<activity
            android:name=".app.WallpaperActivity"
            android:label="@string/activity_wallpaper"
            android:theme="@style/Theme.Wallpaper" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.SAMPLE_CODE" />
            </intent-filter>
        </activity>


<!-- A theme that has a wallpaper background.  Here we explicitly specify
         that this theme is to inherit from the system's wallpaper theme,
         which sets up various attributes correctly. -->
    <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
        <item name="android:colorForeground">#fff</item>
    </style>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐