Xml文件  |  138行  |  5.34 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.
-->

<RelativeLayout 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:background="@color/item_doc_background"
    android:elevation="@dimen/grid_item_elevation"
    android:focusable="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: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" />

        <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: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: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: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/size"
            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/size"
            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>