设置壁纸前推出作物形象活动 [英] Launch crop image activity before setting wallpaper

查看:133
本文介绍了设置壁纸前推出作物形象活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序的用户可以点击一个按钮,从ImageView的墙纸设置图像。

In my application users can click a button to set an image from imageview as wallpaper.

下面是code:

WallpaperManager myWallpaperManager = WallpaperManager
    .getInstance(getApplicationContext());

try {
    myWallpaperManager.setBitmap(
        ((BitmapDrawable) fullSizeImage.getDrawable()).getBitmap());
    //setResource(fullSizeImage.getDrawable());
    Toast.makeText(
        FullSizeImageDisplay.this,
        "Wallpaper set",Toast.LENGTH_SHORT).show();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

这是设置图像作为背景,但不是在所有设备上,其中只有图片的一部分被设置为墙纸正常工作。

It is setting the image as wallpaper, but not working properly on all devices, where only a part of the picture is set as wallpaper.

我想用户得到的选项设置为墙纸,像Android这样的画廊设置图像作为壁纸前,显示之前裁剪图像。

I want user to get an option to crop the image before setting it as wallpaper, like Android shows before setting an image as wallpaper from Gallery.

能从图库该活动从我的应用程序推出裁剪图片或者是有另一种选择?

Can that activity from Gallery be launched from my app to crop image or is there another alternative?

推荐答案

您可以加载图像之后开始的onActivityResult意图。这里你可以开始与这个意图的剪裁,例如:

You could start an intent in onActivityResult after loading Image. There You could start the cropping with this intent, for example:

     Intent cropYourPicIntent = new Intent(
                "com.android.camera.action.CROP");

不过,这只是得到它的想法是什么我的意思是,有很多更code要做。

But this is only to get the idea of it what I mean, there is a lot of more code to do.

这篇关于设置壁纸前推出作物形象活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆