search_bar.xml revision 54b6cfa9a9e5b861a9930af873580d6dc20f773c
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3/* apps/common/res/layout/SearchBar.xml
4**
5** Copyright 2007, The Android Open Source Project
6**
7** Licensed under the Apache License, Version 2.0 (the "License"); 
8** you may not use this file except in compliance with the License. 
9** You may obtain a copy of the License at 
10**
11**     http://www.apache.org/licenses/LICENSE-2.0 
12**
13** Unless required by applicable law or agreed to in writing, software 
14** distributed under the License is distributed on an "AS IS" BASIS, 
15** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
16** See the License for the specific language governing permissions and 
17** limitations under the License.
18*/
19-->
20<LinearLayout
21    xmlns:android="http://schemas.android.com/apk/res/android"
22    android:id="@+id/search_bar"
23    android:layout_width="fill_parent"
24    android:layout_height="fill_parent"
25    android:paddingBottom="14dip"
26    android:orientation="vertical" 
27    android:focusable="true"
28    android:descendantFocusability="afterDescendants">
29
30    <!-- Outer layout defines the entire search bar at the top of the screen -->
31    <!-- Bottom padding of 16 is due to the graphic, with 9 extra pixels of drop
32         shadow, plus the desired padding of "8" against the user-visible (grey)
33         pixels, minus "1" to correct for positioning of the edittext & button. -->
34    <LinearLayout
35        android:layout_width="fill_parent"
36        android:layout_height="wrap_content"
37        android:orientation="vertical"
38        android:paddingLeft="8dip"
39        android:paddingRight="8dip"
40        android:paddingTop="6dip"
41        android:paddingBottom="16dip"
42        android:baselineAligned="false"
43        android:background="@android:drawable/search_plate"
44        android:addStatesFromChildren="true" >
45
46        <!-- This is actually used for the badge icon *or* the badge label (or neither) -->
47        <TextView 
48            android:id="@+id/search_badge"
49            android:layout_width="wrap_content"
50            android:layout_height="wrap_content"
51            android:paddingLeft="2dip"
52            android:drawablePadding="0dip"
53            android:textAppearance="?android:attr/textAppearanceSmall"
54            android:textColor="?android:attr/textColorPrimary" />
55
56        <!-- Inner layout contains the button(s) and EditText -->
57        <!-- The layout_marginTop of "1" corrects for the extra 1 pixel of padding at the top of 
58             textfield_selected.9.png.  The "real" margin as displayed is "2". -->
59        <!-- The layout_marginBottom of "-5" corrects for the spacing we see at the 
60             bottom of the edittext and button images.  The "real" margin as displayed is "8" -->
61        <LinearLayout
62            android:id="@+id/search_edit_frame"
63            android:layout_width="fill_parent"
64            android:layout_height="wrap_content"
65            android:layout_marginTop="1dip"
66            android:layout_marginBottom="-5dip"
67            android:orientation="horizontal"
68            android:addStatesFromChildren="true"
69            android:gravity="center_vertical"
70            android:baselineAligned="false" >
71
72            <EditText
73                android:id="@+id/search_src_text"
74                android:layout_height="wrap_content"
75                android:layout_width="0dip"
76                android:layout_weight="1.0"
77                android:paddingLeft="8dip"
78                android:paddingRight="6dip"
79                android:singleLine="true" />
80                
81            <Button
82                android:id="@+id/search_go_btn"
83                android:text="@string/search_go"
84                android:layout_width="wrap_content"
85                android:layout_height="wrap_content"
86                android:layout_marginLeft="6dip" />
87        </LinearLayout>
88        
89    </LinearLayout>
90
91    <!-- The margintop of -21 adjusts the listview to abut the bottom of the edittext. -->
92    <ListView 
93        android:id="@+id/search_suggest_list"
94        android:layout_marginTop="-21dip"
95        android:layout_width="200dip"
96        android:layout_height="fill_parent"
97        android:background="@android:drawable/spinner_dropdown_background_down"
98        android:divider="@android:drawable/divider_horizontal_bright" 
99        android:cacheColorHint="#FFFFFFFF" />
100
101</LinearLayout>
102