to top
Android APIs
 

widget_layout.xml

← Back

The file containing the source code shown below is located in the corresponding directory in <sdk>/samples/android-<version>/...

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android开源工程

     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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="@dimen/widget_margin_top"
    android:layout_marginBottom="@dimen/widget_margin_bottom"
    android:layout_marginLeft="@dimen/widget_margin_left"
    android:layout_marginRight="@dimen/widget_margin_right">
    <!-- We define separate margins to allow for flexibility in twiddling the margins
         depending on device form factor and target SDK version. -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="fitXY"
            android:src="@drawable/header" />
        <ImageButton
            android:id="@+id/refresh"
            android:layout_width="56dp"
            android:layout_height="39dp"
            android:layout_gravity="right|top"
            android:layout_marginRight="15dp"
            android:layout_marginTop="20dp"
            android:background="@drawable/refresh_button" />
    </FrameLayout>
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_gravity="center"
        android:background="@drawable/body">
        <ListView
            android:id="@+id/weather_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
        <TextView
            android:id="@+id/empty_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:visibility="gone"
            android:textColor="#ffffff"
            android:text="@string/empty_view_text"
            android:textSize="20sp" />
    </FrameLayout>
    <ImageView
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="fitXY"
        android:src="@drawable/footer" />
</LinearLayout>