zhujie
2025-04-03 fe04012057d024770e0180543483d393281a542f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="40dp"> <!-- 留出顶部广告位的高度 -->
        >
 
        <!--    LinearLayout的作用是按照垂直或者水平方向排列其子视图-->
        <!--    CardView组件是用于实现卡片式布局-->
        <!--    RecyclerView 回收商视图 它使用适配器(Adapter)来管理数据的显示,-->
        <!--    开发者可以根据自己的需求实现适配器的方法,将数据与视图进行绑定。-->
        <!--    这使得 RecyclerView 能够轻松地处理各种类型的数据,并按照自定义的布局方式展示。-->
        <!--    支持局部刷新 通知数据集变化-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
 
 
            <!-- 快递/财务切换区域 -->
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginTop="8dp"
                android:layout_marginHorizontal="8dp">
 
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="30dp"
                    android:orientation="horizontal">
 
                    <com.example.firstapp.view.UnderlineTextView
                        android:id="@+id/tabExpress"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:padding="6dp"
                        android:text="快递"
                        android:textSize="14sp"
                        android:textStyle="bold" />
 
                    <com.example.firstapp.view.UnderlineTextView
                        android:id="@+id/tabFinance"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:padding="6dp"
                        android:text="还款"
                        android:textSize="14sp" />
 
                    <com.example.firstapp.view.UnderlineTextView
                        android:id="@+id/tabIncome"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:padding="6dp"
                        android:text="收入"
                        android:textSize="14sp" />
 
                    <com.example.firstapp.view.UnderlineTextView
                        android:id="@+id/tabFlight"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:padding="6dp"
                        android:text="航班"
                        android:textSize="14sp" />
 
                    <com.example.firstapp.view.UnderlineTextView
                        android:id="@+id/tabTrain"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:padding="6dp"
                        android:text="火车票"
                        android:textSize="14sp" />
 
                </LinearLayout>
 
                <ImageButton
                    android:id="@+id/categoryButton"
                    android:layout_width="28dp"
                    android:layout_height="28dp"
                    android:layout_gravity="center_vertical|end"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:contentDescription="分类设置"
                    android:padding="4dp"
                    android:scaleType="fitCenter"
                    android:src="@drawable/home_add" />
 
            </FrameLayout>
 
            <!-- 内容区域 -->
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp">
 
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/express_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp" />
 
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/finance_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp" />
 
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/income_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp" />
 
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/flight_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp"
                    android:visibility="gone" />
 
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/train_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp"
                    android:visibility="gone" />
 
            </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="40dp"
            android:scaleType="centerCrop"
            android:src="@drawable/up_back" />
    </androidx.cardview.widget.CardView>
 
    <!-- 在适当的位置添加 -->
 
</FrameLayout>