Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To display a Dialog with a custom content, </p> <pre><code>ViewGroup myRootViewGroup = /* root ViewGroup of your activity or fragment */; mContext = /* your activity context */; AlertDialog.Builder builder = new AlertDialog.Builder (mContext, AlertDialog.THEME_HOLO_DARK); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.mylayout, (ViewGroup) myRootViewGroup); builder.setView(layout); Dialog dialog = builder.create(); dialog.show(); . . . dialog.dismiss(); </code></pre> <p>great answer at <a href="https://stackoverflow.com/questions/3399667/creating-a-custom-dialog-in-android">Creating a custom dialog in Android</a> on this also.</p> <p>You might also consider that the layout your looking for is basically the standard AlertDialog layout (with no buttons), you can just do builder.setIcon() and builder.setTitle().</p> <p>For your layout, change LinearLayout orientation="horizontal", remove the FrameLayout altogether, set ImageView layout_width="wrap_content". This:</p> <pre><code>&lt;LinearLayout android:id="@id/mylayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src=""/&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@strings/text" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>You'll also likely want to fiddle with padding on the Image/Text Views to get the exact look.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload