Xml文件  |  157行  |  6.78 KB

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 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.
-->

<!-- FYI: This layout has an extra top level container view that was previously used
     to allow for the insertion of debug info. The debug info is now gone, but the
     container remains because there is a high likelihood of UI regression relating
     to focus and selection states, some of which are specific to keyboard
     when touch mode is not enable. So, if you, heroic engineer of the future,
     decide to rip these out, please be sure to check out focus and keyboards. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/grid_item_margin"
    android:orientation="vertical"
    android:background="@drawable/grid_item_background"
    android:elevation="@dimen/grid_item_elevation"
    android:focusable="true">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:duplicateParentState="true">

        <!-- Main item thumbnail.  Comprised of two overlapping images, the
             visibility of which is controlled by code in
             DirectoryFragment.java. -->

        <FrameLayout
            android:id="@+id/thumbnail"
            android:background="@drawable/grid_item_background"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.android.documentsui.GridItemThumbnail
                android:id="@+id/icon_thumb"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:contentDescription="@null"
                android:tint="@color/item_doc_grid_tint"
                android:tintMode="src_over" />

            <com.android.documentsui.GridItemThumbnail
                android:id="@+id/icon_mime_lg"
                android:layout_width="@dimen/icon_size"
                android:layout_height="@dimen/icon_size"
                android:layout_gravity="center"
                android:scaleType="fitCenter"
                android:contentDescription="@null" />

        </FrameLayout>

        <!-- Item nameplate.  Has a mime-type icon and some text fields (title,
             size, mod-time, etc). -->

        <RelativeLayout
            android:id="@+id/nameplate"
            android:background="@drawable/grid_item_background"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/thumbnail"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"
            android:paddingLeft="12dp"
            android:paddingRight="12dp">

            <ImageView
                android:id="@+id/icon_mime_sm"
                android:layout_width="@dimen/grid_item_icon_size"
                android:layout_height="@dimen/grid_item_icon_size"
                android:layout_marginEnd="8dp"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:scaleType="center"
                android:pointerIcon="hand"
                android:contentDescription="@null"/>

            <ImageView
                android:id="@+id/icon_check"
                android:src="@drawable/ic_check_circle"
                android:alpha="0"
                android:layout_width="@dimen/check_icon_size"
                android:layout_height="@dimen/check_icon_size"
                android:layout_marginEnd="8dp"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:scaleType="fitCenter"
                android:pointerIcon="hand"
                android:contentDescription="@null"/>

            <TextView
                android:id="@android:id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toEndOf="@id/icon_mime_sm"
                android:singleLine="true"
                android:ellipsize="end"
                android:textAlignment="viewStart"
                android:textAppearance="@android:style/TextAppearance.Material.Subhead"
                android:textColor="@color/item_title" />

            <TextView
                android:id="@+id/details"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@id/icon_mime_sm"
                android:layout_below="@android:id/title"
                android:layout_marginEnd="4dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:textAlignment="viewStart"
                android:textAppearance="@android:style/TextAppearance.Material.Caption"
                android:textColor="@color/item_details" />

            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@android:id/title"
                android:layout_toEndOf="@id/details"
                android:singleLine="true"
                android:ellipsize="end"
                android:textAlignment="viewStart"
                android:textAppearance="@android:style/TextAppearance.Material.Caption"
                android:textColor="@color/item_details" />

        </RelativeLayout>

        <!-- An overlay that draws the item border when it is focused. -->
        <View
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/nameplate"
            android:layout_alignTop="@id/thumbnail"
            android:layout_alignLeft="@id/thumbnail"
            android:layout_alignRight="@id/thumbnail"
            android:contentDescription="@null"
            android:background="@drawable/item_doc_grid_border"
            android:duplicateParentState="true" />

    </RelativeLayout>

</LinearLayout>