tj
2025-03-25 a8da38115220a0677442899ecf7bf75fd1ef325c
app/src/main/res/layout/fragment_home.xml
@@ -1,30 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
    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">
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.home.HomeFragment">
    android:layout_marginTop="80dp"> <!-- 留出顶部广告位的高度 -->
    >
<!--    <TextView-->
<!--        android:id="@+id/text_home"-->
<!--        android:layout_width="match_parent"-->
<!--        android:layout_height="wrap_content"-->
<!--        android:layout_marginStart="8dp"-->
<!--        android:layout_marginTop="8dp"-->
<!--        android:layout_marginEnd="8dp"-->
<!--        android:textAlignment="center"-->
<!--        android:textSize="20sp"-->
<!--        app:layout_constraintBottom_toBottomOf="parent"-->
<!--        app:layout_constraintEnd_toEndOf="parent"-->
<!--        app:layout_constraintStart_toStartOf="parent"-->
<!--        app:layout_constraintTop_toTopOf="parent" />-->
    <androidx.recyclerview.widget.RecyclerView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/recyclerView"
<!--    LinearLayout的作用是按照垂直或者水平方向排列其子视图-->
<!--    CardView组件是用于实现卡片式布局-->
<!--    RecyclerView 回收商视图 它使用适配器(Adapter)来管理数据的显示,-->
<!--    开发者可以根据自己的需求实现适配器的方法,将数据与视图进行绑定。-->
<!--    这使得 RecyclerView 能够轻松地处理各种类型的数据,并按照自定义的布局方式展示。-->
<!--    支持局部刷新 通知数据集变化-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="8dp"/>
        android:layout_height="wrap_content"
        android:orientation="vertical">
</androidx.constraintlayout.widget.ConstraintLayout>
        <!-- 快递/财务切换区域 -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginBottom="8dp">
            <TextView
                android:id="@+id/tabExpress"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="快递"
                android:gravity="center"
                android:padding="8dp"
                android:textSize="16sp"
                android:textStyle="bold"/>
            <TextView
                android:id="@+id/tabFinance"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="财务"
                android:gravity="center"
                android:padding="8dp"
                android:textSize="16sp"/>
            <TextView
                android:id="@+id/others"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="其他"
                android:gravity="center"
                android:padding="8dp"
                android:textSize="16sp"/>
        </LinearLayout>
        <!-- 内容区域 -->
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="16dp">
            <!-- 快递内容 -->
            <androidx.cardview.widget.CardView
                android:id="@+id/expressContent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardBackgroundColor="@color/light_blue_50"
                app:cardCornerRadius="8dp"
                app:cardElevation="0dp">
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/express_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp"/>
            </androidx.cardview.widget.CardView>
            <!-- 财务内容 -->
            <androidx.cardview.widget.CardView
                android:id="@+id/financeContent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardBackgroundColor="@color/light_blue_50"
                app:cardCornerRadius="8dp"
                app:cardElevation="0dp">
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/finance_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp"/>
            </androidx.cardview.widget.CardView>
        </FrameLayout>
        <!-- 底部广告位 -->
        <androidx.cardview.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardCornerRadius="8dp"
            app:cardElevation="2dp">
            <ImageView
                android:id="@+id/bottomAdBanner"
                android:layout_width="match_parent"
                android:layout_height="80dp"
                android:scaleType="centerCrop"/>
        </androidx.cardview.widget.CardView>
    </LinearLayout>
</ScrollView>
    <!-- 顶部广告位 -->
    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
       >
        <ImageView
            android:id="@+id/adBanner"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:scaleType="centerCrop"
            android:src="@drawable/up"/>
    </androidx.cardview.widget.CardView>
</FrameLayout>