Android清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Live.zaki"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.ui.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme" >
/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
android:label="@string/appName"
android:icon="@drawable/icon">
<service
android:name="com.Live.zaki.CustomWallpaper"
android:label="@string/appName"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/wallpaper" />
</service>
<activity
android:name="com.example.ui.SecondActivity"
android:label="Home" >
</activity>
<activity
android:name=".PrefsActivity"
android:theme="@android:style/Theme.Black.NoTitleBar" >
</activity>
</application>
</manifest>
wallpaper.xml
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/icon"
android:description="@string/appDescription"
android:settingsActivity="com.Live.zaki.PrefsActivity"
/>
的prefs.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/general_lwp_settings">
<CheckBoxPreference
android:key="lwp_o_scroll_lock_key"
android:summary="@string/lwp_o_scroll_lock_summary"
android:title="@string/lwp_o_scroll_lock_title"
android:defaultValue="false" />
<CheckBoxPreference
android:key="lwp_auto_animation_key"
android:summary="@string/lwp_auto_animation_summary"
android:title="@string/lwp_auto_animation_title"
android:defaultValue="false" />
</PreferenceCategory>
PrefsActivity.java
public class PrefsActivity extends PreferenceActivity{@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(com.Live.zaki.R.xml.prefs);
}
}
我还没有在我的主livewallpaper.java代码上配置任何首选项逻辑,我只想让设置菜单弹出“我的情况下的两个复选框”。这有可能吗? 如果有人能帮助我,那就太棒了!提示,教程什么!! 这是我没有设置的应用程序结果,
https://drive.google.com/file/d/0B44QwXQHh5irNFRnYkhzdDhPM00/edit?usp=sharing
答案 0 :(得分:3)
buddy在设置活动中添加导出标志并将其设置为true android:exported =“true”
答案 1 :(得分:0)
将xml文件夹wallpaper.xml文件中的包名称更改为完全限定名称。
android:settingsActivity="yourPackagename.PrefsActivity"
在清单文件中添加:
<activity
android:exported="true"
android:name=".PrefsActivity"
android:theme="@android:style/Theme.Black.NoTitleBar">