王鹏鹏 2 лет назад
Родитель
Сommit
164b66c022

+ 4 - 2
personalcenter/src/main/res/values/themes.xml → personalcenter/src/main/res/values/styles.xml

@@ -1,4 +1,5 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
 
     <!--自适应高度-->
     <style name="layout_properties_self_adaption" tools:ignore="ResourceName">
@@ -53,4 +54,5 @@
         <item name="android:paddingEnd">@dimen/divider_18px</item>
         <item name="android:text">@string/there_is_currently_no_data_available</item>
     </style>
-</resources>
+
+</resources>

+ 7 - 12
push/src/main/res/layout/activity_messge_list.xml

@@ -5,8 +5,7 @@
     tools:ignore="ResourceName">
 
     <androidx.constraintlayout.widget.ConstraintLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        style="@style/push_layout_properties_specify_width_geight"
         android:background="@mipmap/icon_uniform_background">
 
         <LinearLayout
@@ -25,8 +24,7 @@
                 android:background="@mipmap/bg_home" />
 
             <androidx.appcompat.widget.AppCompatTextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+                style="@style/push_layout_properties_self_adaption"
                 android:layout_marginStart="@dimen/divider_14px"
                 android:layout_marginTop="@dimen/divider_38px"
                 android:text="@string/home_pager"
@@ -57,24 +55,21 @@
             android:background="@android:color/white"
             app:cardCornerRadius="@dimen/divider_38px"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintStart_toEndOf="@id/rvPushType"
             app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@id/rvPushType"
             app:layout_constraintTop_toTopOf="parent">
 
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:layout_width="match_parent"
-                android:layout_height="match_parent">
+            <androidx.constraintlayout.widget.ConstraintLayout style="@style/push_layout_properties_specify_width_geight">
 
                 <androidx.appcompat.widget.AppCompatTextView
                     android:id="@+id/tvTitle"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
+                    style="@style/push_layout_properties_self_adaption"
                     android:layout_marginTop="@dimen/divider_31px"
                     android:text="@string/notify"
                     android:textColor="@color/color_FF4A76FF"
                     android:textSize="@dimen/divider_42px"
-                    app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
 
                 <androidx.recyclerview.widget.RecyclerView
@@ -86,8 +81,8 @@
                     android:layout_marginEnd="@dimen/divider_36px"
                     app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                     app:layout_constraintBottom_toBottomOf="parent"
-                    app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/tvTitle" />
             </androidx.constraintlayout.widget.ConstraintLayout>
         </androidx.cardview.widget.CardView>

+ 7 - 13
push/src/main/res/layout/item_push_list.xml

@@ -13,16 +13,14 @@
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/messageLayout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        style="@style/push_layout_properties_specify_width"
         android:layout_marginTop="@dimen/divider_12px"
         android:background="@drawable/bg_item_push"
         android:minHeight="@dimen/divider_105px">
 
         <androidx.appcompat.widget.AppCompatImageView
             android:id="@+id/imageTips"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/push_layout_properties_self_adaption"
             android:layout_marginStart="@dimen/divider_24px"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -30,8 +28,7 @@
 
         <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/pushType"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/push_layout_properties_self_adaption"
             android:layout_marginStart="@dimen/divider_8px"
             android:text="@{data.msgType}"
             android:textColor="@color/color_FF4A76FF"
@@ -41,20 +38,18 @@
             app:layout_constraintTop_toTopOf="parent" />
 
         <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/push_layout_properties_self_adaption"
             android:text="@{data.msgTitle}"
             android:textColor="@color/color_FF4A76FF"
             android:textSize="@dimen/divider_24px"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
 
         <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/tvDate"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/push_layout_properties_self_adaption"
             android:layout_marginTop="@dimen/divider_23px"
             android:layout_marginEnd="@dimen/divider_35px"
             android:textColor="@color/color_FF2B70FF"
@@ -64,8 +59,7 @@
 
         <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/tvStatus"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            style="@style/push_layout_properties_self_adaption"
             android:layout_marginTop="@dimen/divider_4px"
             android:layout_marginEnd="@dimen/divider_35px"
             android:layout_marginBottom="@dimen/divider_23px"

+ 22 - 0
push/src/main/res/values/styles.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!--自适应高度-->
+    <style name="push_layout_properties_self_adaption">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+    </style>
+
+    <!--指定宽度和高度-->
+    <style name="push_layout_properties_specify_width_geight">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">match_parent</item>
+    </style>
+
+    <!--指定宽度-->
+    <style name="push_layout_properties_specify_width">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+    </style>
+
+</resources>