Pradeep Pradeep - 28 days ago 16
C# Question

AlertDialog is shown blank

I am trying to open up a Layout which has an image inside an

AlertDialog
. But I am getting a blank dialog. Here is my code.

ImageView.axml
layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="350dp"
android:id="@+id/imageView"
android:src="@drawable/Apple"
android:scaleType="centerInside" />
</LinearLayout>


C# code:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
AlertDialog dialog = builder.Create();
LayoutInflater inflater = LayoutInflater.From(this);
View dialogLayout = inflater.Inflate(Resource.Layout.ImageView, null);
dialog.SetView(dialogLayout);
dialog.Show();

Answer

Issue was with the Image file size in the drawable folder. Size of the image was too big. When I try an image with smaller size it is working.

Comments