I'm trying to make a custom alertdialog with an ImageView inside:
public static void showFullSizePhoto(ImageView imageView, Context context) {
ImageView tempImageView = imageView;
AlertDialog.Builder imageDialog = new AlertDialog.Builder(context);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.image_dialog,
(ViewGroup) ((Activity) context).findViewById(R.id.layout_root));
ImageView image = (ImageView) layout.findViewById(R.id.user_fullimage);
image.setImageDrawable(tempImageView.getDrawable());
imageDialog.setView(layout);
AlertDialog dialog = imageDialog.create();
dialog.show();
}
image_dialog.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/user_fullimage"
android:layout_width="wrap_content"
android:layout_height="match_parent">
</ImageView>
</LinearLayout>
However it's not displaying my image correctly(see attached picture). How do I get rid of this white stripe, so the dialog window wraps the image?