Home | History | Annotate | Download | only in layout
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!-- Copyright (C) 2008 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 <!-- Demonstrates using a LinearLayout background to group related
     18      TextViews, EditTexts, and Buttons. -->
     19 
     20 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     21     android:layout_width="match_parent"
     22     android:layout_height="wrap_content"
     23     android:orientation="vertical">
     24 
     25     <!-- Top label/button text field. -->
     26 
     27     <LinearLayout
     28         android:layout_width="match_parent"
     29         android:layout_height="wrap_content"
     30         android:addStatesFromChildren="true"
     31         android:gravity="center_vertical"
     32         android:paddingRight="0dip"
     33         android:background="@android:drawable/edit_text">
     34 
     35         <!--
     36             TextView label goes at the left.
     37         -->
     38         <TextView
     39             android:layout_width="wrap_content"
     40             android:layout_height="wrap_content"
     41             android:text="@string/linear_layout_10_from"
     42             android:textColor="?android:attr/textColorSecondary"
     43             android:textAppearance="?android:attr/textAppearanceLargeInverse"
     44         />
     45 
     46         <!--
     47             EditText goes in between.
     48         -->
     49         <EditText
     50             android:layout_width="wrap_content"
     51             android:layout_height="wrap_content"
     52             android:layout_weight="1"
     53             android:singleLine="true"
     54             android:background="@null"
     55         />
     56 
     57         <!--
     58             The button goes at the right.
     59         -->
     60         <ImageButton
     61             style="@android:style/Widget.Button.Inset"
     62             android:src="@android:drawable/star_big_on"
     63             android:layout_width="wrap_content"
     64             android:layout_height="wrap_content"
     65             android:layout_marginTop="2dip"
     66             android:layout_marginRight="2dip"
     67             android:layout_marginBottom="2dip"
     68             android:padding="10dip"
     69         />
     70 
     71     </LinearLayout>
     72 
     73     <!-- Bottom label/button text field.  (Identical to the top one
     74          except for the label.)  -->
     75 
     76     <LinearLayout
     77         android:layout_width="match_parent"
     78         android:layout_height="wrap_content"
     79         android:addStatesFromChildren="true"
     80         android:gravity="center_vertical"
     81         android:paddingRight="0dip"
     82         android:background="@android:drawable/edit_text">
     83 
     84         <!--
     85             TextView label goes at the left.
     86         -->
     87         <TextView
     88             android:layout_width="wrap_content"
     89             android:layout_height="wrap_content"
     90             android:text="@string/linear_layout_10_to"
     91             android:textColor="?android:attr/textColorSecondary"
     92             android:textAppearance="?android:attr/textAppearanceLargeInverse"
     93         />
     94 
     95         <!--
     96             EditText goes in between.
     97         -->
     98         <EditText
     99             android:layout_width="wrap_content"
    100             android:layout_height="wrap_content"
    101             android:layout_weight="1"
    102             android:singleLine="true"
    103             android:background="@null"
    104         />
    105 
    106         <!--
    107             The button goes at the right.
    108         -->
    109         <ImageButton
    110             style="@android:style/Widget.Button.Inset"
    111             android:src="@android:drawable/star_big_on"
    112             android:layout_width="wrap_content"
    113             android:layout_height="wrap_content"
    114             android:layout_marginTop="2dip"
    115             android:layout_marginRight="2dip"
    116             android:layout_marginBottom="2dip"
    117             android:padding="10dip"
    118         />
    119 
    120     </LinearLayout>
    121 
    122 </LinearLayout>
    123