From 149f61100f29141e393ade0f66d10fce620c6a61 Mon Sep 17 00:00:00 2001
From: Administrator <123>
Date: Tue, 26 Oct 2021 07:52:12 +0000
Subject: [PATCH] recycler item 取消使用constraintlayout

---
 app/src/main/res/layout/home_item_top.xml       |   92 +++++++++---------
 app/src/main/res/layout/homt_item_recommend.xml |  176 ++++++++++++++++-------------------
 2 files changed, 126 insertions(+), 142 deletions(-)

diff --git a/app/src/main/res/layout/home_item_top.xml b/app/src/main/res/layout/home_item_top.xml
index 7362407..218b2fe 100644
--- a/app/src/main/res/layout/home_item_top.xml
+++ b/app/src/main/res/layout/home_item_top.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout 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"
@@ -9,6 +9,7 @@
     android:layout_marginTop="5dp"
     android:layout_marginRight="5dp"
     android:padding="10dp"
+    android:orientation="vertical"
     tools:ignore="MissingConstraints">
 
     <TextView
@@ -23,10 +24,7 @@
         android:paddingTop="3dp"
         android:paddingBottom="3dp"
         android:background="@drawable/bg_border_red_corner"
-        tools:layout_editor_absoluteX="0dp"
-        tools:layout_editor_absoluteY="4dp"
         tools:text="类型" />
-
     <TextView
         android:id="@+id/txt_title"
         android:layout_width="wrap_content"
@@ -34,52 +32,54 @@
         android:layout_marginStart="4dp"
         android:text="任务标题\nl;ajsdlfkjalsjd"
         android:textColor="@color/black"
-        android:layout_marginTop="10dp"
-        app:layout_constraintTop_toBottomOf="@id/txt_type"
-        tools:layout_editor_absoluteY="23dp" />
-
-    <TextView
-        android:id="@+id/txt_label"
+        android:layout_marginTop="10dp"/>
+    <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:background="@drawable/bg_red_corner"
-        android:text="标签"
-        android:textSize="10sp"
-        android:textColor="@color/white"
-        android:padding="3dp"
-        android:layout_marginRight="10dp"
-        app:layout_constraintBottom_toBottomOf="@id/txt_title"
-        app:layout_constraintTop_toTopOf="@id/image_head"/>
+        android:layout_marginTop="@dimen/frame_margin_lr"
+        android:orientation="horizontal">
 
-    <TextView
-        android:id="@+id/txt_detail"
-        android:layout_width="wrap_content"
+
+        <TextView
+            android:id="@+id/txt_label"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="@drawable/bg_red_corner"
+            android:layout_gravity="center_vertical"
+            android:text="标签"
+            android:textSize="10sp"
+            android:textColor="@color/white"
+            android:padding="3dp"
+            android:layout_marginRight="10dp"/>
+        <TextView
+            android:id="@+id/txt_detail"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="参与人数\n剩余数量" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:text="参与人数\n剩余数量"
-        android:layout_marginTop="8dp"
-        android:layout_marginLeft="10dp"
-        app:layout_constraintLeft_toRightOf="@id/txt_label"
-        app:layout_constraintTop_toBottomOf="@id/txt_title" />
+        android:orientation="horizontal">
 
-    <ImageView
-        android:id="@+id/image_head"
-        android:layout_width="43dp"
-        android:layout_height="32dp"
-        android:scaleType="centerCrop"
-        android:layout_marginTop="8dp"
-        app:layout_constraintTop_toBottomOf="@id/txt_detail"
-        tools:srcCompat="@tools:sample/avatars" />
+        <ImageView
+            android:id="@+id/image_head"
+            android:layout_width="43dp"
+            android:layout_height="32dp"
+            android:scaleType="centerCrop"
+            android:layout_marginTop="8dp"
+            tools:srcCompat="@tools:sample/avatars" />
 
-    <TextView
-        android:id="@+id/txt_price"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="TextView"
-        android:layout_marginLeft="10dp"
-        android:textColor="@color/red"
-        app:layout_constraintLeft_toRightOf="@id/image_head"
-        app:layout_constraintTop_toTopOf="@id/image_head"
-        app:layout_constraintBottom_toBottomOf="@id/image_head"
-        tools:text="+ 35.00元" />
+        <TextView
+            android:id="@+id/txt_price"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="+ 35.00元"
+            android:layout_marginLeft="10dp"
+            android:textColor="@color/red"
+            android:layout_gravity="center_vertical"  />
+    </LinearLayout>
 
-</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/homt_item_recommend.xml b/app/src/main/res/layout/homt_item_recommend.xml
index 0974968..b7e8631 100644
--- a/app/src/main/res/layout/homt_item_recommend.xml
+++ b/app/src/main/res/layout/homt_item_recommend.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout 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:padding="@dimen/frame_margin_lr"
@@ -10,119 +10,103 @@
         android:id="@+id/image_head"
         android:layout_width="50dp"
         android:layout_height="50dp"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_gravity="center_vertical"
         tools:srcCompat="@tools:sample/avatars" />
-
-    <TextView
-        android:id="@+id/txt_title"
-        android:layout_width="wrap_content"
+    <LinearLayout
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:textColor="@color/black"
-        android:text="标题"
-        android:textSize="14sp"
-        android:layout_marginLeft="@dimen/frame_margin_lr"
-        app:layout_constraintLeft_toRightOf="@id/image_head"
-        app:layout_constraintTop_toTopOf="parent"
-        />
-
-    <TextView
-        android:id="@+id/txt_label"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="标签"
-        android:textColor="@color/red"
-        android:layout_marginTop="4dp"
-        android:paddingLeft="4dp"
-        android:paddingRight="4dp"
-        android:paddingTop="2dp"
-        android:paddingBottom="2dp"
-        android:textSize="10sp"
-        android:background="@drawable/bg_border_slender_red_corner"
-        android:layout_marginLeft="@dimen/frame_margin_lr"
-        app:layout_constraintTop_toBottomOf="@id/txt_title"
-        app:layout_constraintLeft_toRightOf="@id/image_head"/>
-
-    <TextView
-        android:id="@+id/txt_detail"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="3dp"
-        android:text="100人完成 | 剩余数100"
-        android:layout_marginLeft="@dimen/frame_margin_lr"
-        app:layout_constraintTop_toBottomOf="@id/txt_label"
-        app:layout_constraintLeft_toRightOf="@id/image_head" />
-
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent">
+        android:orientation="vertical"
+        android:layout_weight="1">
 
         <TextView
-            android:id="@+id/txt_index"
+            android:id="@+id/txt_title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="顶"
-            android:paddingLeft="3dp"
-            android:paddingRight="3dp"
-            android:textSize="10sp"
-            android:background="@drawable/bg_red_corner"
-            android:textColor="@color/white"
-            android:layout_marginRight="10dp"
-            app:layout_goneMarginRight="0dp"
-            app:layout_constraintBottom_toTopOf="@id/txt_price"
-            app:layout_constraintHorizontal_chainStyle="spread"
-            app:layout_constraintHorizontal_weight="1"
-            app:layout_constraintLeft_toLeftOf="parent"
-            app:layout_constraintRight_toLeftOf="@id/txt_recommend"/>
+            android:textColor="@color/black"
+            android:text="标题"
+            android:textSize="14sp"
+            android:layout_marginLeft="@dimen/frame_margin_lr"
+            />
 
         <TextView
-            android:id="@+id/txt_recommend"
+            android:id="@+id/txt_label"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="推"
-            android:paddingLeft="3dp"
-            android:paddingRight="3dp"
+            android:text="标签"
+            android:textColor="@color/red"
+            android:layout_marginTop="4dp"
+            android:paddingLeft="4dp"
+            android:paddingRight="4dp"
+            android:paddingTop="2dp"
+            android:paddingBottom="2dp"
             android:textSize="10sp"
-            android:background="@drawable/bg_red_corner"
-            android:textColor="@color/white"
-            android:layout_marginRight="10dp"
-            android:visibility="gone"
-            app:layout_goneMarginRight="0dp"
-            app:layout_constraintBottom_toTopOf="@id/txt_price"
-            app:layout_constraintHorizontal_chainStyle="spread"
-            app:layout_constraintHorizontal_weight="1"
-            app:layout_constraintRight_toLeftOf="@id/txt_deposit"
-            app:layout_constraintLeft_toRightOf="@id/txt_index"/>
+            android:background="@drawable/bg_border_slender_red_corner"
+            android:layout_marginLeft="@dimen/frame_margin_lr"/>
 
         <TextView
-            android:id="@+id/txt_deposit"
+            android:id="@+id/txt_detail"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="保"
-            android:paddingLeft="3dp"
-            android:paddingRight="3dp"
-            android:textSize="10sp"
-            android:background="@drawable/bg_red_corner"
-            android:textColor="@color/white"
-            android:visibility="gone"
-            app:layout_constraintBottom_toTopOf="@id/txt_price"
-            app:layout_constraintHorizontal_chainStyle="spread"
-            app:layout_constraintHorizontal_weight="1"
-            app:layout_constraintLeft_toRightOf="@id/txt_recommend"
-            app:layout_constraintRight_toRightOf="parent"/>
+            android:layout_marginTop="3dp"
+            android:text="100人完成 | 剩余数100"
+            android:layout_marginLeft="@dimen/frame_margin_lr"/>
+    </LinearLayout>
+
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:layout_gravity="center_vertical"
+        android:gravity="center">
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/txt_index"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="顶"
+                android:paddingLeft="3dp"
+                android:paddingRight="3dp"
+                android:textSize="10sp"
+                android:background="@drawable/bg_red_corner"
+                android:textColor="@color/white"
+                android:layout_marginRight="10dp"/>
+
+            <TextView
+                android:id="@+id/txt_recommend"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="推"
+                android:paddingLeft="3dp"
+                android:paddingRight="3dp"
+                android:textSize="10sp"
+                android:background="@drawable/bg_red_corner"
+                android:textColor="@color/white"
+                android:layout_marginRight="10dp" />
+
+            <TextView
+                android:id="@+id/txt_deposit"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="保"
+                android:paddingLeft="3dp"
+                android:paddingRight="3dp"
+                android:textSize="10sp"
+                android:background="@drawable/bg_red_corner"
+                android:textColor="@color/white" />
+        </LinearLayout>
 
         <TextView
             android:id="@+id/txt_price"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="+ 35.00元"
-            android:textColor="@color/red"
-            app:layout_constraintLeft_toLeftOf="parent"
-            app:layout_constraintRight_toRightOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent" />
-    </androidx.constraintlayout.widget.ConstraintLayout>
-</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
+            android:textColor="@color/red" />
+    </LinearLayout>
+</LinearLayout>
\ No newline at end of file

--
Gitblit v1.9.1