tj
2025-04-01 6ada2c53c4e28f7524fe9439563bc4adfab2ca41
1.vip续费页面-页面样式优化
已修改3个文件
512 ■■■■ 文件已修改
app/src/main/java/com/example/firstapp/ui/vip/MemberInfoCardViewModel.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/drawable/member_background.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_vip.xml 500 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/example/firstapp/ui/vip/MemberInfoCardViewModel.kt
@@ -19,7 +19,7 @@
    val memberStatus: StateFlow<String> = _memberStatus
    // 头像
    private val _cover = MutableStateFlow("")
    private val _cover = MutableStateFlow("http://192.168.1.201:9000/sms/avatar/avatar_default.png")
    val cover: StateFlow<String> = _cover
    // vip头像
@@ -67,7 +67,11 @@
            }
            // 头像
            _cover.value = userInfo.cover
            // 如果头像不为空的话,则更新头像
            if(userInfo.cover.isNotEmpty()){
                _cover.value = userInfo.cover
            }
        }
    }
app/src/main/res/drawable/member_background.xml
@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#000000"
        android:endColor="#7A7596"
        android:startColor="#2B225C"
        android:endColor="#726C8E"
        android:angle="90"/>
</shape>
app/src/main/res/layout/activity_vip.xml
@@ -5,283 +5,287 @@
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activity.VipActivity">
<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"
    tools:context=".activity.VipActivity">
    <androidx.coordinatorlayout.widget.CoordinatorLayout
    <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="wrap_content"
        android:fitsSystemWindows="true"
        android:background="@drawable/member_background">
        android:layout_height="match_parent"
        android:fillViewport="true"
        tools:context=".activity.VipActivity">
        <!-- 这里是原来CoordinatorLayout中的内容,保持不变 -->
        <com.google.android.material.appbar.AppBarLayout
        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true"
            android:background="@android:color/transparent">
            android:background="@drawable/member_background">
            <com.google.android.material.appbar.MaterialToolbar
                android:id="@+id/toolbar"
            <!-- 这里是原来CoordinatorLayout中的内容,保持不变 -->
            <com.google.android.material.appbar.AppBarLayout
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize">
                <!-- 直接在Toolbar中添加TextView -->
                <ImageView
                    android:id="@+id/ivBack"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="left"
                    android:layout_marginStart="16dp"
                    android:src="@drawable/ic_back" />
                <TextView
                    android:id="@+id/tvTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="智信会员"
                    android:textColor="#FFFFFF"
                    android:textSize="18sp"
                    android:layout_gravity="left"
                    android:layout_marginEnd="16dp" />
            </com.google.android.material.appbar.MaterialToolbar>
                android:layout_height="wrap_content"
                android:fitsSystemWindows="true"
                android:background="@android:color/transparent">
        </com.google.android.material.appbar.AppBarLayout>
        <!-- 引入MemberInfoCardFragment -->
        <fragment
            android:name="com.example.firstapp.ui.vip.MemberInfoCardFragment"
            android:id="@+id/memberInfoCardFragment"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
                <com.google.android.material.appbar.MaterialToolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize">
                    <!-- 直接在Toolbar中添加TextView -->
                    <ImageView
                        android:id="@+id/ivBack"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:layout_marginStart="16dp"
                        android:src="@drawable/ic_back" />
                    <TextView
                        android:id="@+id/tvTitle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="智信会员"
                        android:textColor="#FFFFFF"
                        android:textSize="18sp"
                        android:layout_gravity="left"
                        android:layout_marginEnd="16dp" />
                </com.google.android.material.appbar.MaterialToolbar>
        <!-- 滑动框 -->
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="145dp"
            android:layout_marginLeft="15dp"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            android:background="@android:color/transparent" />
            </com.google.android.material.appbar.AppBarLayout>
            <!-- 引入MemberInfoCardFragment -->
            <fragment
                android:name="com.example.firstapp.ui.vip.MemberInfoCardFragment"
                android:id="@+id/memberInfoCardFragment"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />
            <!-- 滑动框 -->
            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="165dp"
                android:layout_marginLeft="15dp"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                android:background="@android:color/transparent" />
<!--        会员权益&#45;&#45;动态-->
        <androidx.constraintlayout.widget.ConstraintLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/benefit_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="270dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:padding="0dp"
            android:background="@android:color/transparent"
            app:cardBackgroundColor="@android:color/transparent"
            android:foreground="@drawable/gray_border_shape"
            tools:context=".MainActivity">
                        <!-- 标题 -->
                        <TextView
                            android:id="@+id/title_text"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="会员权益"
                            android:textColor="#8A5C37"
                            android:textSize="20sp"
                            android:textStyle="bold"
                            app:layout_constraintTop_toTopOf="parent"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintHorizontal_bias="0.5"
                            android:layout_marginTop="5dp" />
                        <!-- 分割线 -->
                        <View
                            android:id="@+id/divider"
                            android:layout_width="0dp"
                            android:layout_height="1dp"
                            android:background="#615B7F"
                            app:layout_constraintTop_toBottomOf="@id/title_text"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintEnd_toEndOf="parent"
                            android:layout_marginTop="8dp"
                            android:layout_marginHorizontal="16dp" />
            <!--        会员权益&#45;&#45;动态-->
            <androidx.constraintlayout.widget.ConstraintLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/dynamicContainer"
                android:id="@+id/benefit_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:layout_marginTop="0dp"
                android:layout_marginTop="300dp"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="15dp"
                android:padding="5dp"
                android:background="@android:color/transparent"
                app:layout_constraintTop_toBottomOf="@id/divider"
                app:cardBackgroundColor="@android:color/transparent"
                android:foreground="@drawable/gray_border_shape"
                tools:context=".MainActivity">
                <!-- 标题 -->
                <TextView
                    android:id="@+id/title_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="会员权益"
                    android:textColor="#8A5C37"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.5"
                    android:layout_marginTop="5dp" />
                <!-- 分割线 -->
                <View
                    android:id="@+id/divider"
                    android:layout_width="0dp"
                    android:layout_height="1dp"
                    android:background="#615B7F"
                    app:layout_constraintTop_toBottomOf="@id/title_text"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    android:layout_marginTop="8dp"
                    android:layout_marginHorizontal="16dp" />
                <androidx.constraintlayout.widget.ConstraintLayout
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:app="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/dynamicContainer"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="20dp"
                    android:layout_marginTop="0dp"
                    android:background="@android:color/transparent"
                    app:layout_constraintTop_toBottomOf="@id/divider"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    />
            </androidx.constraintlayout.widget.ConstraintLayout>
            <!--        更多权益-->
            <LinearLayout
                android:id="@+id/more_benefit_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/more_benefit_shape"
                android:layout_marginTop="550dp"
                android:layout_marginLeft="13dp"
                android:layout_marginRight="13dp"
                android:padding="15dp"
                android:orientation="vertical"
                android:gravity="center">
                <TextView
                    android:id="@+id/more_benefit_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="更多权益敬请期待"
                    android:textColor="#D5D4DA"
                    android:textStyle="italic|bold"
                    android:textSize="16sp"
                    android:layout_marginBottom="10dp"
                    android:gravity="center"
                    android:layout_gravity="center"/>
                <!-- 第一项 -->
                <LinearLayout
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="start"
                    android:baselineAligned="false"
                    android:layout_marginBottom="8dp"
                    android:padding="5dp"
                    >
                    <ImageView
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:src="@mipmap/vip_ai_ass_icon"
                        android:layout_marginEnd="8dp"/>
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="解锁AI语音助手"
                        android:textColor="#93B7D9"
                        android:textSize="16sp"
                        android:gravity="start"/>
                </LinearLayout>
                <!-- 第二项 -->
                <LinearLayout
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="start"
                    android:baselineAligned="false"
                    android:layout_marginBottom="8dp"
                    android:padding="5dp"
                    >
                    <ImageView
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:src="@mipmap/vip_bar_sta"
                        android:layout_marginEnd="8dp"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="数据智能预测"
                        android:textColor="#93B7D9"
                        android:textSize="16sp"
                        android:gravity="start"/>
                </LinearLayout>
                <!-- 第三项 -->
                <LinearLayout
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="start"
                    android:baselineAligned="false"
                    android:layout_marginBottom="8dp"
                    android:padding="5dp"
                    >
                    <ImageView
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:src="@mipmap/vip_life_insurance"
                        android:layout_marginEnd="8dp"/>
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="家庭分类共享"
                        android:textColor="#93B7D9"
                        android:textSize="16sp"
                        android:gravity="start"/>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="160dp"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="start"
                    android:baselineAligned="false"
                    android:layout_marginBottom="8dp"
                    android:padding="5dp"
                    >
                    <ImageView
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:src="@mipmap/vip_more"
                        android:layout_marginEnd="8dp"/>
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="敬请期待......"
                        android:textColor="#D6D5DB"
                        android:textSize="16sp"
                        android:gravity="start"/>
                </LinearLayout>
            </LinearLayout>
            <View
                android:id="@+id/divider2"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="#646174"
                app:layout_constraintTop_toBottomOf="@id/more_benefit_layout"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                android:layout_marginTop="840dp"
                android:layout_marginHorizontal="0dp" />
                />
        </androidx.constraintlayout.widget.ConstraintLayout>
<!--        更多权益-->
        <LinearLayout
            android:id="@+id/more_benefit_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/more_benefit_shape"
            android:layout_marginTop="480dp"
            android:layout_marginLeft="13dp"
            android:layout_marginRight="13dp"
            android:padding="10dp"
            android:orientation="vertical"
            android:gravity="center">
            <TextView
                android:id="@+id/more_benefit_text"
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="更多权益敬请期待"
                android:textColor="#D5D4DA"
                android:textStyle="italic|bold"
                android:textSize="16sp"
                android:layout_marginBottom="10dp"
                android:gravity="center"
                android:layout_gravity="center"/>
            <!-- 第一项 -->
            <LinearLayout
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="start"
                android:baselineAligned="false"
                android:layout_marginBottom="8dp"
                android:layout_height="180dp"
                android:layout_marginTop="880dp"
                >
                <ImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:src="@mipmap/vip_ai_ass_icon"
                    android:layout_marginEnd="8dp"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="解锁AI语音助手"
                    android:textColor="#93B7D9"
                    android:textSize="16sp"
                    android:gravity="start"/>
            </LinearLayout>
            <!-- 第二项 -->
            <LinearLayout
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="start"
                android:baselineAligned="false"
                android:layout_marginBottom="8dp"
                >
                <ImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:src="@mipmap/vip_bar_sta"
                    android:layout_marginEnd="8dp"
                    />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="数据智能预测"
                    android:textColor="#93B7D9"
                    android:textSize="16sp"
                    android:gravity="start"/>
            </LinearLayout>
            <!-- 第三项 -->
            <LinearLayout
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="start"
                android:baselineAligned="false"
                android:layout_marginBottom="8dp"
                >
                <ImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:src="@mipmap/vip_life_insurance"
                    android:layout_marginEnd="8dp"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="家庭分类共享"
                    android:textColor="#93B7D9"
                    android:textSize="16sp"
                    android:gravity="start"/>
            </LinearLayout>
            <LinearLayout
                android:layout_width="160dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="start"
                android:baselineAligned="false"
                android:layout_marginBottom="8dp"
                >
                <ImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:src="@mipmap/vip_more"
                    android:layout_marginEnd="8dp"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="敬请期待......"
                    android:textColor="#D6D5DB"
                    android:textSize="16sp"
                    android:gravity="start"/>
            </LinearLayout>
        </LinearLayout>
        <View
            android:id="@+id/divider2"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#646174"
            app:layout_constraintTop_toBottomOf="@id/more_benefit_layout"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            android:layout_marginTop="690dp"
            android:layout_marginHorizontal="0dp" />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_marginTop="880dp"
            >
        </LinearLayout>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.core.widget.NestedScrollView>
        </androidx.coordinatorlayout.widget.CoordinatorLayout>
    </androidx.core.widget.NestedScrollView>
    <androidx.cardview.widget.CardView
        android:id="@+id/card_view_fixed"