【起航计划 016】2015 起航计划 Android(安卓)APIDemo的魔鬼步伐 15 App->Activity->Wallpaper 系统壁纸作为当前Activity的背景
16lz
2022-06-08
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>
更多相关文章
- android自定义属性之format介绍
- Android中使用XmlSerializer拼装XML数据
- Android实现手写板和涂鸦功能
- Android: 自定义Tab样式
- android背景选择器selector用法、自定义Button按钮样式.........
- Android在XML中自定义控件的使用
- Toolbar上overflow的样式自定义详解
- 使用valgrind检测Android(安卓)native程序的内存
- Android中自定义属性的格式详解