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 <EditText 40 android:layout_width="match_parent" 41 android:layout_height="wrap_content"/> 42 43 <!-- 44 Use a horizontal layout to hold the two buttons. 45 This item has layout_gravity="right". This means the whole 46 horizontal LinearLayout is right aligned, not the individual 47 items within it. The horizontal LinearLayout's width is set to 48 wrap_content. (If it was match_parent it would not have any 49 room to slide to the right.) 50 --> 51 <LinearLayout 52 android:orientation="horizontal" 53 android:layout_width="wrap_content" 54 android:layout_height="wrap_content" 55 android:layout_gravity="right" > 56 57 <Button 58 android:layout_width="wrap_content" 59 android:layout_height="wrap_content" 60 android:text="@string/linear_layout_5_cancel"/> 61 62 <Button 63 android:layout_width="wrap_content" 64 android:layout_height="wrap_content" 65 android:layout_marginLeft="10dip" 66 android:text="@string/linear_layout_5_ok" /> 67 68 </LinearLayout> 69 70</LinearLayout> 71