Xml文件  |  106行  |  4.53 KB

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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.
-->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@color/phone_theme"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:background="@color/telecom_display_scrim"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- In order for this FrameLayout's elevation to show up, there needs to be a background
         set on it that's not transparent. Therefore, set it as the same color as
         phone_theme. -->
    <FrameLayout
        android:id="@+id/search_container"
        android:background="@color/phone_theme"
        android:layout_width="match_parent"
        android:layout_height="@dimen/car_app_bar_height" >

        <FrameLayout
            android:background="@color/telecom_display_scrim"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <!-- This FrameLayout is used to center the ImageView in a space that is the width of
             car_keyline_1. -->
        <FrameLayout
            android:layout_width="@dimen/car_keyline_1"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/back"
                android:background="@drawable/dialer_ripple_background"
                android:layout_gravity="center"
                android:layout_width="@dimen/car_touch_target_size"
                android:layout_height="@dimen/car_touch_target_size"
                android:src="@drawable/ic_arrow_back"
                android:scaleType="center"
                android:tint="@color/car_grey_50" />
        </FrameLayout>

        <androidx.car.widget.ColumnCardView
            android:layout_gravity="center"
            android:layout_width="match_parent"
            android:layout_height="@dimen/search_container_height"
            android:elevation="0dp"
            app:cardBackgroundColor="@color/car_card"
            app:cardCornerRadius="@dimen/search_container_radius">

            <ImageView
                android:layout_gravity="start|center_vertical"
                android:layout_width="@dimen/car_touch_target_size"
                android:layout_height="@dimen/car_touch_target_size"
                android:src="@drawable/ic_search"
                android:scaleType="center"
                android:tint="@color/search_container_controls_tint"/>

            <EditText
                android:id="@+id/search_field"
                android:layout_marginStart="@dimen/car_touch_target_size"
                android:layout_marginEnd="@dimen/car_touch_target_size"
                android:layout_gravity="center"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPersonName|textCapWords"
                android:hint="@string/search_hint"
                android:textColorHint="@color/search_container_text_hint"
                style="@style/TextAppearance.Car.Body1" />

            <ImageView
                android:id="@+id/clear"
                android:background="@drawable/dialer_ripple_background"
                android:layout_gravity="end|center_vertical"
                android:layout_width="@dimen/car_touch_target_size"
                android:layout_height="@dimen/car_touch_target_size"
                android:src="@drawable/ic_cancel"
                android:scaleType="center"
                android:tint="@color/search_container_controls_tint"/>
        </androidx.car.widget.ColumnCardView>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/content_fragment_container"
        android:layout_marginTop="@dimen/car_app_bar_height"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</FrameLayout>