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<!-- This file describes the layout of the main SkeletonApp activity 18 user interface. 19 --> 20 21<!-- The top view is a layout manager that places its child views into 22 a row, here set to be vertical (so the first is at the top) --> 23 24<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 25 android:layout_width="match_parent" android:layout_height="match_parent" 26 android:orientation="vertical"> 27 28 <!-- First view is a text editor. We want it to use all available 29 horizontal space, and stretch to fill whatever vertical space 30 is available to it. Note the use of the "id" attribute, which 31 allows us to find this object from the Java code. --> 32 <EditText android:id="@+id/editor" 33 android:layout_width="match_parent" android:layout_height="0dip" 34 android:autoText="true" 35 android:capitalize="sentences" 36 android:layout_weight="1" 37 android:freezesText="true" > 38 <requestFocus /> 39 </EditText> 40 41 <!-- Next view is another linear layout manager, now horizontal. We 42 give it a custom background; see colors.xml for the definition 43 of drawable/semi_black--> 44 <LinearLayout 45 android:layout_width="wrap_content" android:layout_height="wrap_content" 46 android:layout_gravity="center_vertical" android:gravity="center_horizontal" 47 android:orientation="horizontal" 48 android:background="@drawable/semi_black"> 49 50 <!-- On the left: the "back" button. See styles.xml for the 51 definition of style/ActionButton, which we use to hold 52 common attributes that are used for both this and the 53 clear button. See strings.xml for the definition of 54 string/back. --> 55 <Button android:id="@+id/back" style="@style/ActionButton" 56 android:text="@string/back" /> 57 58 <!-- In the middle: a custom image, --> 59 <ImageView android:id="@+id/image" 60 android:layout_width="wrap_content" android:layout_height="wrap_content" 61 android:paddingLeft="4dip" android_paddingRight="4dip" 62 android:src="@drawable/violet" /> 63 64 <!-- On the right: another button, this time with its text color 65 changed to red. Again, see colors.xml for the definition. --> 66 <Button android:id="@+id/clear" style="@style/ActionButton" 67 android:text="@string/clear" android:textColor="@color/red" /> 68 69 </LinearLayout> 70 71</LinearLayout> 72 73 74