GestureImageView试图从相机设定编程时,位图变成空白 [英] GestureImageView goes blank when trying to set bitmap from camera programatically

查看:244
本文介绍了GestureImageView试图从相机设定编程时,位图变成空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用:
https://github.com/jasonpolites/gesture-imageview


    对应用负载
  • ,它在捏/ A GestureImageView一个占位符图像缩放适当。我有一个按钮,当点击触发相机意图,保存文件,然后我想设置的图像是在gestureimageview使用的源位图。

  • on load of the app, it has a placeholder image in a GestureImageView that pinch/zooms appropriately. I have a button that when clicks fires a camera intent, saves the file, and then I wish to set that image to be the source bitmap used in the gestureimageview.

GestureImageView的ImageView =(GestureImageView)findViewById(R.id.imageViewOne);

GestureImageView imageView = (GestureImageView) findViewById(R.id.imageViewOne);

ContentResolver cr = getContentResolver();

getContentResolver().notifyChange(imageUriOne, null);


                try {
Bitmap mybitmap =  android.provider.MediaStore.Images.Media.getBitmap(cr, imageUriOne);

 imageView.setImageBitmap(mybitmap);

}

对于一个正常的ImageView,工程。但对于GestureImageView,图像保持为原始一旦从相机意图回来,如果触及消失。

For a normal imageview, that works. But for the GestureImageView, the image stays as the original once returned from the camera intent, and if touched disappears.

要检查它的不是这就是问题所在,我尝试了位图

To check it's not the bitmap that's the problem, I tried

int idTwo=getResources().getIdentifier("com.jazz.test1:drawable/second_photo", null, null);

imageView.setImageResource(idTwo);

即。设置的ImageView到现有的资源,但这种有同样的问题。

I.e. set the imageview to an existing resource, but this has the same problem.

如果我称之为setImageResource code的的意图,它的工作。

If I call that setImageResource code before the intent, it does work.

任何想法如何调试?有在日志中没有任何错误。

Any ideas how to debug? There are no errors in the logs.

推荐答案

解决方案是在这里:

https://github.com/jasonpolites/gesture-imageview/issues/21


  • 没有当我最初看着GitHub的问题,注意到了这一点。

这篇关于GestureImageView试图从相机设定编程时,位图变成空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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