本文介绍了如何在Android对话框中设置ImageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Android对话框中显示图像.如果我从图库应用程序中选择图像,则该图像应显示在对话框中.我试图从图库应用程序中获取选定的图像,并将其路径传递到警报对话框.
I am trying to display an image in an android dialog. If I select an image from the gallery app it should be displayed in a dialog. I have tried to fetch the selected image from the gallery app and passed its path to an alert dialog.
推荐答案
AlertDialog.Builder ImageDialog = new AlertDialog.Builder(MainActivity.this);
ImageDialog.setTitle("Title");
ImageView showImage = new ImageView(MainActivity.this);
ImageDialog.setView(showImage);
ImageDialog.setNegativeButton("ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface arg0, int arg1)
{
}
});
ImageDialog.show();
这篇关于如何在Android对话框中设置ImageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!