使活动出现在“壁纸选择器”出现在、壁纸、选择器

2023-09-06 13:51:06 作者:Heart plug(心塞)

我希望我的行为出现在活动列表(画廊。动态壁纸等)时,尽量选择从主屏幕壁纸,你看到的。

I want my activity to appear in the list of activities (gallery. live wallpapers, etc) that you see when you try to choose a wallpaper from the home screen.

林假设这是有意向做,但不能似乎找到一个工作。最近的一个我能找到的:

Im assuming this is done with intents but cant seem to find one that works. The closest one I can find is:

<action android:name="android.intent.action.ACTION_SET_WALLPAPER>

但是,这并不工作,似乎是用别的东西。

but that doesn't work and seems to be used for something else.

推荐答案

这应该是意图过滤器,你想要的:

This should be the intent-filter you want:

<intent-filter>
    <action android:name="android.intent.action.SET_WALLPAPER" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

定义如下:http://developer.android.com/reference/android/content/Intent.html#ACTION_SET_WALLPAPER

(默认类别是意图标准的语法。)

(The DEFAULT category is a standard syntax for intents.)

 
精彩推荐
图片推荐