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

Android ApiDemos示例解析(18):App->Activity->Wallpaper

2012-06-07 16:14 567 查看
Wallpaper介绍一个Activity如何通过Style把系统Wallpaper作为当前Activity的背景。

这是WallpaperActivity在AndroidManifest.xml中的定义:

<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>

@style/Theme.Wallpaper定义如下:继承系统android:style/Theme.Wallpaper,并将前景色设为白色(这里是文字的颜色)

<!– 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>



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: