Xml文件  |  84行  |  3.23 KB

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:background="#F8F8F8"
        android:orientation="horizontal">
        <ImageView
            android:id="@+id/city_weather"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="12dp"
            android:scaleType="fitStart"
            android:adjustViewBounds="true"
            android:src="@drawable/sunny" />
        <TextView
            android:id="@+id/city_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:text="@string/city_name"
            android:textAllCaps="true"
            android:textColor="#232323"
            android:textSize="24sp" />
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_gravity="center"
        android:background="#F8F8F8">
        <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>

    <Button
        android:id="@+id/refresh"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:gravity="center"
        android:background="#F8F8F8"
        android:text="@string/refresh"
        android:textAllCaps="true"
        android:textColor="#232323"
        android:textSize="14sp" />
</LinearLayout>