Xml文件  |  68行  |  2.89 KB

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

<!-- BEGIN_INCLUDE(complete) -->
<!-- This layout is designed for use with FLAG_LAYOUT_IN_OVERSCAN, so its window will
     be placed into the overscan region of the display (if there is one).  Thus the contents
     of the top-level view may be obscured around the edges by the display, leaving the
     edge of the box background used here invisible. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/box_white">

    <!-- This is still in the same position as the top-level FrameLayout, so the contentx
        of this TextView may also be obscured. -->
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp"
        android:layout_marginLeft="3dp"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Overscan" />

    <!-- This FrameLayout uses android:fitsSystemWindows to have its padding adjusted so
         that within that space its content is offset to not be obscured by the overscan
         region (or also system decors that are covering its UI. -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <!-- Now that we are within the padding region of the parent FrameLayout, we can
             safely place content that will be visible to the user. -->
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/frantic"
            android:scaleType="fitXY" />
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/box_white" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="3dp"
            android:layout_marginLeft="3dp"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Content" />

    </FrameLayout>

</FrameLayout>
<!-- END_INCLUDE(complete) -->