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>
![](http://www.imobilebbs.com/wordpress/wp-content/uploads/2011/05/20110504005.png)
这是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>
![](http://www.imobilebbs.com/wordpress/wp-content/uploads/2011/05/20110504005.png)
相关文章推荐
- Android ApiDemos示例解析(9):App->Activity->Persistent State
- Android ApiDemos示例解析(15):App->Activity->SetWallpaper
- Android ApiDemos示例解析(14):App->Activity->Save & Restore State
- Android ApiDemos示例解析(16):App->Activity->Translucent
- Android ApiDemos示例解析(11):App->Activity->Receive Result
- Android ApiDemos示例解析(14):App->Activity->Save & Restore State
- Android ApiDemos示例解析(14):App->Activity->Save & Restore State
- Android ApiDemos示例解析(5):App->Activity->Custom Title
- Android ApiDemos示例解析(3): App->Activity->Animation
- Android ApiDemos示例解析(6):App->Activity->Dialog
- Android ApiDemos示例解析(12):App->Activity->Redirection
- Android ApiDemos示例解析(10):App->Activity->QuickContactsDemo
- Android ApiDemos示例解析(4):App->Activity->Custom Dialog
- Android ApiDemos示例解析(13):App->Activity->Reorder Activities
- Android ApiDemos示例解析(17):App->Activity->Translucent Blur
- Android ApiDemos示例解析(14):App->Activity->Save & Restore State
- Android ApiDemos示例解析(8):App->Activity->Hello world
- Android ApiDemos示例解析(7):App->Activity->Forwarding
- Android ApiDemos示例解析(16):App->Activity->Translucent
- Android ApiDemos示例解析(12):App->Activity->Redirection