我有一张图片,我目前正在使用imageview设置它。
我希望在单击Imageview时,会出现一个像对话框一样的弹出窗口,显示图像..任何方法我怎样才能实现这一点。
Context mContext = getApplicationContext();
Dialog dialog = new Dialog(mContext);
dialog.setContentView(R.layout.customdialog);
dialog.setTitle("wateva");
ImageView ivDialog = (ImageView) dialog.findViewById(R.id.ivDialog);
String filepath = Environment.getExternalStorageDirectory().getPath();
folder = new File(filepath,"checking");
File fa = new File(folder,"bmp1.png");
Bitmap bmpa = BitmapFactory.decodeFile(fa.getAbsolutePath());
Log.d("error " , "here");
ivDialog.setImageBitmap(bmpa);
dialog.show();
答案 0 :(得分:2)
使用 CustomDialog 来创建具有Imageview和其他组件的.Create布局,并将其设置为Dialog。
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialoglayout);
ImageView imgView=(ImageView)dialog.findViewById(R.id.imagview);
//set image to imgView
dialog.show();