Popupwindow with image

后端 未结 1 1774
旧时难觅i
旧时难觅i 2020-12-08 23:57

I need to be able to click an imgview in a listview, which should open a popup showing the image fullsize. I\'ve managed to implement the cli

1条回答
  •  生来不讨喜
    2020-12-09 00:02

    Create custom-dialog and pass image in it....

    private void loadPhoto(ImageView imageView, int width, int height) {
    
            ImageView tempImageView = imageView;
    
    
            AlertDialog.Builder imageDialog = new AlertDialog.Builder(this);
            LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
    
            View layout = inflater.inflate(R.layout.custom_fullimage_dialog,
                    (ViewGroup) findViewById(R.id.layout_root));
            ImageView image = (ImageView) layout.findViewById(R.id.fullimage);
            image.setImageDrawable(tempImageView.getDrawable());
            imageDialog.setView(layout);
            imageDialog.setPositiveButton(resources.getString(R.string.ok_button), new DialogInterface.OnClickListener(){
    
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
    
            });
    
    
            imageDialog.create();
            imageDialog.show();     
        }
    

    custom_fullimage_dialog.xml:

    
        
        
    
        
        
    
    

    0 讨论(0)
提交回复
热议问题