Xml文件  |  79行  |  3.33 KB

<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2015 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.tv.menu.ChannelCardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="@dimen/card_layout_width"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:focusable="true"
    android:clickable="true">

    <FrameLayout
        android:layout_width="@dimen/card_image_layout_width"
        android:layout_height="@dimen/card_image_layout_height">

        <ImageView android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="top"
            android:scaleType="centerCrop"/>

        <View android:id="@+id/image_gradient"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:background="@drawable/card_image_gradient"
            android:visibility="gone" />

        <!-- The bottom margin specified in the redline is 8dp, but the redline doesn't consider
             the descenders. So actually, if the bottom margin is set to 8dp, the bottom line of
             the text lies 11dp above the bottom of the poster art due to the descenders.
             Therefore the bottom margin needs to be set to 5dp(=8dp-3dp) here.
             If the text size or font is changed, the bottom margin needs to be changed. -->
        <TextView android:id="@+id/channel_number_and_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start|bottom"
            android:layout_marginStart="12dp"
            android:layout_marginEnd="12dp"
            android:layout_marginBottom="5dp"
            android:fontFamily="@string/condensed_font"
            android:textColor="@color/card_meta_text_color_enabled"
            android:textSize="12sp" />

        <ProgressBar android:id="@+id/progress"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="match_parent"
            android:layout_height="@dimen/channel_card_progress_bar_height"
            android:layout_gravity="bottom"
            android:mirrorForRtl="false"
            android:progressDrawable="@drawable/channel_card_progress_bar"
            android:indeterminate="false"
            android:max="100"
            android:visibility="gone" />

    </FrameLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/channel_card_meta_background">
        <include layout="@layout/menu_card_text" />
    </FrameLayout>

</com.android.tv.menu.ChannelCardView>