- 修改布局文件,移除 btnChangeNow - 调整 btnNext 约束和样式(改为实心按钮) - 删除 btnChangeNow 相关代码: - 字段声明 - 初始化和点击监听 - changeWallpaperNow() 方法 - showNoWallpaper() 和 showError() 中的引用 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
79 lines
3.1 KiB
XML
79 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<androidx.core.widget.NestedScrollView
|
|
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"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:fillViewport="true">
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:padding="16dp"
|
|
tools:context=".ui.CurrentWallpaperFragment">
|
|
|
|
<ImageView
|
|
android:id="@+id/ivWallpaper"
|
|
android:layout_width="0dp"
|
|
android:layout_height="0dp"
|
|
android:scaleType="centerCrop"
|
|
android:background="@android:color/darker_gray"
|
|
android:adjustViewBounds="true"
|
|
android:maxHeight="400dp"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintDimensionRatio="9:16"
|
|
android:contentDescription="当前壁纸预览" />
|
|
|
|
<TextView
|
|
android:id="@+id/tvWallpaperPath"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:text="当前壁纸路径"
|
|
android:textSize="14sp"
|
|
android:textStyle="bold"
|
|
android:layout_marginTop="16dp"
|
|
android:maxLines="2"
|
|
android:ellipsize="middle"
|
|
app:layout_constraintTop_toBottomOf="@id/ivWallpaper"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent" />
|
|
|
|
<TextView
|
|
android:id="@+id/tvWallpaperSize"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:text="尺寸"
|
|
android:textSize="12sp"
|
|
android:layout_marginTop="4dp"
|
|
app:layout_constraintTop_toBottomOf="@id/tvWallpaperPath"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent" />
|
|
|
|
<Button
|
|
android:id="@+id/btnNext"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:text="下一张"
|
|
android:layout_marginTop="16dp"
|
|
app:layout_constraintTop_toBottomOf="@id/tvWallpaperSize"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent" />
|
|
|
|
<Button
|
|
android:id="@+id/btnOpenInGallery"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:text="在相册中打开"
|
|
android:layout_marginTop="8dp"
|
|
style="@style/Widget.Material3.Button.OutlinedButton"
|
|
app:layout_constraintTop_toBottomOf="@id/btnNext"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent" />
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
|
</androidx.core.widget.NestedScrollView>
|