In the Android docs on AlertDialog, it gives the following instruction and example for setting a custom view in an AlertDialog:
If you want to display a
The simplest lines of code that works for me are are follows:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(R.layout.layout_resource_id);
builder.show();
Whatever the type of layout(LinearLayout, FrameLayout, RelativeLayout) will work by setView
and will just differ in the appearance and behavior.