【问题标题】:Choose wallpaper instead of choosing live wallpaper?选择壁纸而不是选择动态壁纸?
【发布时间】:2014-03-14 02:21:05
【问题描述】:

在 Android 中,有一种非常方便的方法可以让用户选择和设置动态壁纸。

Intent intent = new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
startActivity(intent);

用户是否有类似的方式来选择和设置壁纸(或者更好的是,允许他们选择壁纸/动态壁纸/画廊)?

谢谢!

【问题讨论】:

    标签: android android-intent gallery live wallpaper


    【解决方案1】:

    试试这个:

    private void chooseWallpaper() {
    
    final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
    Intent chooser = Intent.createChooser(pickWallpaper, getText(R.string.chooser_wallpaper));
    startActivityForResult(chooser, REQUEST_PICK_WALLPAPER);
    }
    

    【讨论】:

    • 这个 REQUEST_PICK_WALLPAPER 在哪里?
    • 这似乎有效(因为我不需要结果): startActivity(Intent.createChooser(new Intent(Intent.ACTION_SET_WALLPAPER), getText(R.string.wallpaper)));跨度>
    • REQUEST_PICK_WALLPAPER 是一个整数,任意整数都可以。
    • @LimThyeChean 是的,REQUEST_PICK_WALLPAPER 只是为了得到结果。StartActivity 方法就足够了。
    【解决方案2】:

    试试这个

    public void setIt(){
    
    Context c = this.getBaseContext();
    Bitmap bp = BitmapFactory.decodeResource(getResources(), "your_array");
    c.setWallpaper(bp);
    }
    

    【讨论】:

    • 不确定我是否得到你 - WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER 允许用户选择可用的动态壁纸,我正在寻找一种选择可用壁纸的方法(不是创建我自己的)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多