XML Layout File for the Prompt Dialog

When we show the prompt dialog, we need to show a prompt TextView followed by an edit box where a user can type a reply. Listing 5-22 contains the XML layout file for the prompt dialog. If you call this file prompt_layout.xml, then you need to place it in the /res/layout subdirectory to produce a resource ID called R.layout.prompt_layout.

Listing 5-22. The prompt_layout.xml File

<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>

0 0

Post a comment