Xml文件  |  246行  |  10.27 KB

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<com.android.quicksearchbox.ui.SearchActivityViewTwoPane
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/search_activity_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
>

    <!-- A background area that when touched dismisses the activity if the search box is empty.
         The top and bottom margins are here to avoid accidental dismissal when
         using the keyboard or the widgets along the top of the screen. -->
    <FrameLayout
            android:id="@+id/dismiss_bg"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="80dip"
            android:layout_marginBottom="30dip"
            />

    <LinearLayout
            android:id="@+id/panes"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:orientation="horizontal"
            android:splitMotionEvents="true">

        <!-- Begin left_pane for suggestions -->
        <RelativeLayout
                android:id="@+id/left_pane"
                android:layout_width="@dimen/suggestions_width"
                android:layout_height="match_parent"
                android:layout_marginLeft="5dp"
                android:layout_marginBottom="12dip"
                >

            <FrameLayout
                android:id="@+id/suggestions_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentLeft="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/search_plate"
                >

                <view
                    class="com.android.quicksearchbox.ui.SuggestionsView"
                    android:id="@+id/suggestions"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingBottom="12dip"
                    android:cacheColorHint="@android:color/transparent"
                    android:scrollbars="none"
                    android:divider="@android:color/transparent"
                    android:dividerHeight="0px"
                    >
                </view>

            </FrameLayout>

            <!-- The search plate is after the suggestions, to give it a higher
                 z-index. -->
            <LinearLayout
                android:id="@+id/search_plate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="11dp"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_alignParentRight="true"
                android:gravity="top|left"
                android:orientation="horizontal"
                android:clickable="true"
                >

                <LinearLayout
                    android:id="@+id/search_edit_frame"
                    android:layout_width="0dip"
                    android:layout_height="36dp"
                    android:layout_weight="1.0"
                    android:orientation="horizontal"
                    android:gravity="center_vertical"
                    android:background="@drawable/textfield_start"
                    >

                    <ImageView
                        android:id="@+id/search_app_icon"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:paddingLeft="8dp"
                        android:layout_gravity="center"
                        android:src="@drawable/ic_search"
                    />

                    <com.android.quicksearchbox.ui.QueryTextView
                        android:id="@+id/search_src_text"
                        android:layout_width="0dip"
                        android:layout_height="match_parent"
                        android:layout_weight="1.0"
                        android:layout_marginBottom="1dip"
                        android:layout_marginLeft="5dip"
                        android:layout_marginRight="8dip"
                        android:gravity="center_vertical|left"
                        android:singleLine="true"
                        android:ellipsize="end"
                        android:inputType="text|textAutoComplete"
                        android:background="@drawable/textfield_search_empty_google"
                        android:textSize="18sp"
                        android:textStyle="normal"
                        android:textColor="@android:color/primary_text_dark"
                        android:textColorHint="@color/search_hint"
                        android:imeOptions="actionGo"
                    />

                    <ImageButton
                        android:id="@+id/search_close_btn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="12dp"
                        android:paddingRight="12dp"
                        android:layout_gravity="center"
                        android:background="@drawable/button_bg"
                        android:src="@drawable/ic_clear_disabled"
                        />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="78dip"
                    android:layout_height="36dp"
                    android:orientation="horizontal"
                    android:gravity="center"
                    android:background="@drawable/textfield_end" >
                    <!-- One of these two will be visible at a time -->
                    <ImageButton
                        android:id="@+id/search_go_btn"
                        android:background="@drawable/button_bg"
                        android:src="@drawable/ic_go"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_gravity="center"
                        android:scaleType="centerInside"
                        />
                    <ImageButton
                        android:id="@+id/search_voice_btn"
                        android:background="@drawable/button_bg"
                        android:src="@drawable/ic_btn_speak_now"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_gravity="center"
                        android:visibility="gone"
                        android:scaleType="centerInside"
                    />
                </LinearLayout>

            </LinearLayout>

        </RelativeLayout>
        <!-- End left_pane -->

        <!-- Begin right_pane -->
        <RelativeLayout
                android:id="@+id/right_pane"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:layout_marginLeft="16dp"
                android:layout_marginBottom="12dip"
                >

            <view
                class="com.android.quicksearchbox.ui.ClusteredSuggestionsView"
                android:id="@+id/shortcuts"
                android:layout_width="@dimen/shortcuts_width"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignWithParentIfMissing="true"
                android:layout_below="@+id/shortcut_title"
                android:cacheColorHint="@android:color/transparent"
                android:scrollbars="none"
                android:groupIndicator="@null"
                android:listSelector="@drawable/suggestion_highlight"
                android:divider="@android:color/transparent"
                android:dividerHeight="0px"
                android:childDivider="@android:color/transparent"
                android:fadingEdge="vertical"
                android:fadingEdgeLength="20dip"
                android:focusable="true"
                >

             </view>

            <!-- The search plate is after the suggestions, to give it a higher
                 z-index. -->
            <RelativeLayout
                android:id="@+id/shortcut_title"
                android:layout_width="@dimen/shortcuts_width"
                android:layout_height="48dp"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:background="@drawable/section_header"
                android:clickable="true"
                android:visibility="invisible"
                >

            </RelativeLayout>

        </RelativeLayout>

        <ImageButton
            android:id="@+id/menu_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right|top"
            android:paddingTop="5dip"
            android:paddingRight="10dip"
            android:paddingLeft="10dip"
            android:paddingBottom="10dip"
            android:singleLine="true"
            android:clickable="true"
            android:focusable="true"
            android:background="@drawable/button_bg"
            android:src="@drawable/ic_menu_moreoverflow_normal_holo_dark"
        />

    </LinearLayout>
</com.android.quicksearchbox.ui.SearchActivityViewTwoPane>