1. prompt_layout.xml File
[Html]
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: orientation = "vertical">
<TextView
Android: id = "@ + id/promptmessage"
Android: layout_height = "wrap_content"
Android: layout_width = "wrap_content"
Android: layout_marginLeft = "20dip"
Android: layout_marginRight = "20dip"
Android: text = "Your text goes here"
Android: gravity = "left"
Android: textAppearance = "? Android: attr/textAppearanceMedium "/>
<EditText
Android: id = "@ + id/editText_prompt"
Android: layout_height = "wrap_content"
Android: layout_width = "fill_parent"
Android: layout_marginLeft = "20dip"
Android: layout_marginRight = "20dip"
Android: scrollHorizontally = "true"
Android: autoText = "false"
Android: capitalize = "none"
Android: gravity = "fill_horizontal"
Android: textAppearance = "? Android: attr/textAppearanceMedium "/>
</LinearLayout>
2. java files
[Java]
LayoutInflater li = LayoutInflater. from (this );
View view = li. inflate (R. layout. prompt_layout, null );
// Get a builder and set the view
AlertDialog. Builder builder = new AlertDialog. Builder (this );
Builder. setTitle ("Prompt ");
Builder. setView (view );
Builder. setPositiveButton ("OK", null );
Builder. setNegativeButton ("cancel", null );
Builder. create ();
Builder. show ();
3.
From Snowball