From 32b40371a31b3984e01f5a072e8e9c7a1e6acc2b Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期三, 12 三月 2025 17:00:38 +0800 Subject: [PATCH] fix: 1 --- app/src/main/res/layout/fragment_dashboard.xml | 93 +++++++++++++++++++++++++++++++--------------- 1 files changed, 63 insertions(+), 30 deletions(-) diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml index 8e543a4..ad51843 100644 --- a/app/src/main/res/layout/fragment_dashboard.xml +++ b/app/src/main/res/layout/fragment_dashboard.xml @@ -81,49 +81,82 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:padding="16dp"> + android:padding="16dp" + android:weightSum="3"> - <ImageView - android:layout_width="0dp" - android:layout_height="48dp" - android:layout_weight="1" - android:src="@drawable/resource_package" /> - - <TextView - android:id="@+id/text_package_count" + <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp" android:layout_weight="1" - android:textSize="24sp" - android:textStyle="bold" - tools:text="4个" /> + android:gravity="center"> + + <ImageView + android:layout_width="48dp" + android:layout_height="48dp" + android:src="@drawable/resource_package" /> + </LinearLayout> + + <Space + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center"> + + <TextView + android:id="@+id/text_package_count" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="24sp" + android:textStyle="bold" + tools:text="4个" /> + </LinearLayout> + </LinearLayout> </androidx.cardview.widget.CardView> - <!-- 包裹列表 --> - <ViewFlipper - android:id="@+id/view_flipper_stats" + <!-- 年度统计布局 --> + <include + android:id="@+id/layout_year_stats" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/card_package_stats"> + android:visibility="gone" + app:layout_constraintTop_toBottomOf="@id/card_package_stats" + layout="@layout/layout_year_stats" /> - <!-- 日视图 --> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_packages" + <!-- 包裹列表和统计图表 --> + <androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="0dp" + android:fillViewport="true" + app:layout_constraintTop_toBottomOf="@id/layout_year_stats" + app:layout_constraintBottom_toBottomOf="parent"> + + <ViewFlipper + android:id="@+id/view_flipper_stats" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content"> - <!-- 周视图 --> - <include - android:id="@+id/layout_week_stats" - layout="@layout/layout_week_stats" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> + <!-- 日视图 --> + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_packages" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clipToPadding="false" + android:paddingBottom="16dp" /> - <!-- 月视图和年视图可以根据需要添加 --> + <!-- 周视图 --> + <include + android:id="@+id/layout_week_stats" + layout="@layout/layout_week_stats" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> - </ViewFlipper> + </ViewFlipper> + </androidx.core.widget.NestedScrollView> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file -- Gitblit v1.9.3