Files
VscoolOS/app/src/main/res/layout/activity_weather.xml
Fanhuitong 4657e3ad2b version:1.0.1
update:优化屏幕适配,更换图标
bugfixes:
2024-07-13 15:22:39 +08:00

217 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.weather.WeatherActivity">
<data>
<variable
name="click"
type="com.xxpatx.os.activity.weather.WeatherActivity.ClickListener" />
<variable
name="nowBaseBean"
type="com.qweather.sdk.bean.weather.WeatherNowBean.NowBaseBean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/weather_background_day">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_back"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="8dp"
android:adjustViewBounds="true"
android:onClick="@{click::exit}"
android:scaleType="centerCrop"
android:src="@drawable/icon_exit"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView16"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="4dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/icon_location"
app:layout_constraintBottom_toBottomOf="@+id/iv_back"
app:layout_constraintStart_toEndOf="@+id/iv_back"
app:layout_constraintTop_toTopOf="@+id/iv_back" />
<TextView
android:id="@+id/tv_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:onClick="@{click::selectAddress}"
android:text="天气预报"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView16"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_refresh"
android:layout_width="48dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:adjustViewBounds="true"
android:gravity="center"
android:onClick="@{click::refresh}"
android:scaleType="centerCrop"
android:text="刷新"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<!-- <ScrollView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:maxLines="1"
android:textColor="@color/gray"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="2024-04-07 星期日" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_marginTop="4dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tv_date">
<TextView
android:id="@+id/tv_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginTop="16dp"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="54sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:setTemp="@{nowBaseBean.getTemp()}"
tools:text="0℃" />
<TextView
android:id="@+id/tv_text_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="16dp"
android:maxLines="1"
android:text="@{nowBaseBean.getText()}"
android:textColor="@color/gray"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/tv_temp"
app:layout_constraintTop_toBottomOf="@id/tv_temp"
tools:text="雷阵雨" />
<TextView
android:id="@+id/tv_min_max"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:maxLines="1"
android:textColor="@color/gray"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/tv_text_day"
app:layout_constraintStart_toEndOf="@+id/tv_text_day"
app:layout_constraintTop_toTopOf="@+id/tv_text_day"
tools:text="24℃-30℃" />
<ImageView
android:id="@+id/iv_pic"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginEnd="40dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:setTempIcon="@{nowBaseBean.getIcon()}"
tools:src="@drawable/he999" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_weather"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/weather_background"
android:overScrollMode="never"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- </ScrollView>-->
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>