1 <?xml version="1.0" encoding="utf-8"?> 2 <!-- Copyright (C) 2007 The Android Open Source Project 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 --> 16 17 <!-- 18 Demonstrates a nesting layouts to make a form 19 --> 20 21 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 22 android:orientation="vertical" 23 android:background="@drawable/blue" 24 android:layout_width="match_parent" 25 android:layout_height="wrap_content" 26 android:padding="10dip"> 27 28 <!-- 29 TextView goes on top... 30 --> 31 <TextView 32 android:layout_width="match_parent" 33 android:layout_height="wrap_content" 34 android:text="@string/linear_layout_5_instructions"/> 35 36 <!-- 37 Followed by the EditText field... 38 39 Also give it a standard background (the "android:" 40 part in @android:drawable/editbox_background 41 means it is system resource rather than 42 an application resource. 43 --> 44 <EditText 45 android:layout_width="match_parent" 46 android:layout_height="wrap_content" 47 android:background="@android:drawable/editbox_background"/> 48 49 <!-- 50 Use a horizontal layout to hold the two buttons. 51 This item has layout_gravity="right". This means the whole 52 horizontal LinearLayout is right aligned, not the individual 53 items within it. The horizontal LinearLayout's width is set to 54 wrap_content. (If it was match_parent it would not have any 55 room to slide to the right.) 56 --> 57 <LinearLayout 58 android:orientation="horizontal" 59 android:layout_width="wrap_content" 60 android:layout_height="wrap_content" 61 android:layout_gravity="right" > 62 63 <Button 64 android:layout_width="wrap_content" 65 android:layout_height="wrap_content" 66 android:text="@string/linear_layout_5_cancel"/> 67 68 <Button 69 android:layout_width="wrap_content" 70 android:layout_height="wrap_content" 71 android:layout_marginLeft="10dip" 72 android:text="@string/linear_layout_5_ok" /> 73 74 </LinearLayout> 75 76 </LinearLayout> 77