【问题标题】:Image not appearing/not found in android popup图像未出现/未在 android 弹出窗口中找到
【发布时间】:2013-05-16 14:33:37
【问题描述】:
String cardpath = Global.directory + longPressBtn.getText().toString() + ".jpg";
System.out.println(cardpath);

AlertDialog imageDialog = new AlertDialog.Builder(mContext).create();
LayoutInflater inflater = LayoutInflater.from(mContext);
imageDialog.setTitle("Title");
View view = inflater.inflate(R.layout.cardpopup, null); 
File imgFile = new File("cardpath");
Bitmap myBitmap = BitmapFactory.decodeFile(cardpath);

ImageView myImage = new ImageView(mContext);
myImage.setImageBitmap(myBitmap);

imageDialog.setView(view);
imageDialog.show();

我正在尝试在按下按钮时显示带有图像的弹出窗口。上面的代码是我的尝试,它不起作用。 cardpath 变量应该是图像绝对路径的字符串。但是,按下按钮时,什么也没有出现。卡路径定义的图片确实存在,而且我有外部存储读取权限,所以我不确定出了什么问题。

【问题讨论】:

    标签: android imageview android-alertdialog bitmapfactory


    【解决方案1】:

    由于我没有看到您缩放图像,请检查您的 logcat - 您可能会看到一行 OpenGLRenderer = Bitmap too large to be uploading into a texture。

    【讨论】:

      猜你喜欢
      • 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
      相关资源
      最近更新 更多