Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add title to the custom Dialog?
    text
    copied!<p>How can i add title to this custom dialog??</p> <p><img src="https://i.stack.imgur.com/luw1g.jpg" alt="enter image description here"></p> <p>I have tried like this</p> <pre><code>public void customDialog() { Dialog dialog=new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); dialog.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.string.app_name ); dialog.setContentView(R.layout.dialog_submit); TextView edit_model=(TextView) dialog.findViewById(R.id.edit_model); edit_model.setText(android.os.Build.DEVICE); dialog.show(); }//end of custom dialog function </code></pre> <p>I have tried to set title like this too..<code>dialog.setTitle("Enter Details");</code> but this too didn't yielded any result. So how can i set title to this custom dialog??</p> <p>This is my dialog_submit.xml file used for the custom dialog.</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_root" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" &gt; &lt;TextView android:id="@+id/txt_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FFF" android:text="Name" android:textStyle="bold" /&gt; &lt;EditText android:id="@+id/edit_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/txt_name" /&gt; &lt;TextView android:id="@+id/txt_model" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FFF" android:layout_below="@+id/edit_name" android:text="Phone Model" /&gt; &lt;TextView android:id="@+id/edit_model" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/txt_model" /&gt; &lt;Button android:id="@+id/but_cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/edit_model" android:text="Cancel" /&gt; &lt;Button android:id="@+id/but_submit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/edit_model" android:layout_toRightOf="@+id/but_cancel" android:text="Submit" /&gt; &lt;/RelativeLayout&gt; </code></pre>
 

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