Android Application Development (AND-401) — Question 88

Which UI does the following code builds?
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=http:// schemas.android.com/apk/res/android android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Post" />
</LinearLayout>

Answer options

Correct answer: C

Explanation

The correct answer is C because the XML structure indicates that the EditText is positioned to the right of the TextView within a horizontal LinearLayout, with the Button located below them in the vertical LinearLayout. Options A and D are incorrect as they misplace the Button or the EditText relative to the TextView, and option B incorrectly describes the layout by placing the Button to the right of the TextView.