【问题标题】:How to create a settings activity for Android Live Wallpaper如何为 Android 动态壁纸创建设置活动
【发布时间】:2012-01-28 22:38:27
【问题描述】:
如何在这样的动态壁纸中创建设置活动?
Example Picture
我只用一个简单的文本构建了设置活动,但遇到了一些问题。
第一个问题是我不能为此活动使用布局 XML 文件。
第二个:当我尝试以编程方式构建该活动时,我无法将目录设置为系统图标 (drawable/ic_menu_more)。
我还需要使用 SeekBar。
如果你能帮助我,我会很高兴 =)
【问题讨论】:
标签:
java
android
android-activity
settings
live-wallpaper
【解决方案1】:
使用系统图标:
<service android:name="com.livewallpaper.warm.LiveWallpaper"
android:label="@string/app_name"
android:icon="@drawable/ic_menu_more">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/livewallpaper" />
</service>
在 XML-livewallpaper.xml 中:
<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.livewallpaper.warm.LiveWallpaperSettings"
android:thumbnail="@drawable/ic_menu_more"/>