From c7f4c1276f9369292f4c48b463fdaa4c68262155 Mon Sep 17 00:00:00 2001 From: ningwenqiang Date: Thu, 29 Aug 2024 11:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=89=E6=8B=A9=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=B1=BB=E5=9E=8BTab=E9=A1=B5=E7=9A=84=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=B1=BB=E5=9E=8B=E5=92=8C=E5=AE=9E=E7=8E=B0=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=EF=BC=88=E5=87=8F=E5=B0=91=E4=BA=8C=E6=AC=A1=E5=B1=82?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=B1=82=E7=BA=A7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/views/MainMessageViewHolder.java | 17 +- .../src/main/res/layout/view_main_message.xml | 581 ++++++++++++------ 2 files changed, 391 insertions(+), 207 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java index a227aa485..ff8e5df8c 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java @@ -32,6 +32,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.constraintlayout.widget.Group; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; @@ -137,17 +138,17 @@ public class MainMessageViewHolder extends AbsMainViewHolder { private MagicIndicator mIndicator; private List fragmentList; - private ConstraintLayout tabLayout1, tabLayout2, tabLayout3; + private Group tabLayout1, tabLayout2, tabLayout3; private TextView tab1, tab2, tab3; private ImageView imageView1, imageView2, imageView3; private View tab_line1, tab_line2, tab_line3; private ImageView tab_icon; - private List relativeLayouts = new ArrayList<>(); + private List relativeLayouts = new ArrayList<>(); private List tabTexts = new ArrayList<>(); private List tabLine = new ArrayList<>(); private List tabExpend = new ArrayList<>(); - private LinearLayout tabLayouts; + private ConstraintLayout tabLayouts; private int userType = 0; // (0)普通用户 (1)主播A (2)主播B ChatViewModel chatViewModel; @@ -202,9 +203,9 @@ public class MainMessageViewHolder extends AbsMainViewHolder { tabLayouts = findViewById(R.id.tabLayouts); tab_icon = findViewById(R.id.tab_icon); - tabLayout1 = findViewById(R.id.tabLayout1); - tabLayout2 = findViewById(R.id.tabLayout2); - tabLayout3 = findViewById(R.id.tabLayout3); + tabLayout1 = findViewById(R.id.group_tab1); + tabLayout2 = findViewById(R.id.group_tab2); + tabLayout3 = findViewById(R.id.group_tab3); tab1 = findViewById(R.id.tab1); tab2 = findViewById(R.id.tab2); @@ -255,7 +256,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder { MainMessageChatListFragment chatFragment = (MainMessageChatListFragment) fragment; ImageView expendImg = (ImageView) view; expendImg.setImageResource(R.mipmap.ic_expend_up); - XPopup.Builder builder = new XPopup.Builder(mContext).atView(relativeLayouts.get(position)); + XPopup.Builder builder = new XPopup.Builder(mContext).atView(tabTexts.get(position)); builder.offsetY(16); builder.dismissOnTouchOutside(true); builder.setPopupCallback(new XPopupCallback() { @@ -523,7 +524,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder { } for (int i = 0; i < relativeLayouts.size(); i++) { int finalI = i; - relativeLayouts.get(i).setOnClickListener(new View.OnClickListener() { + tabTexts.get(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectTab(finalI); diff --git a/main/src/main/res/layout/view_main_message.xml b/main/src/main/res/layout/view_main_message.xml index 8c1a02219..5bc51d7be 100644 --- a/main/src/main/res/layout/view_main_message.xml +++ b/main/src/main/res/layout/view_main_message.xml @@ -303,229 +303,412 @@ android:layout_height="37dp" android:visibility="gone" /> - + android:paddingStart="12dp" + android:paddingEnd="12dp"> - + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/tab1" + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible" /> - - - - - - - - - - - - - - - + + + app:layout_constraintBottom_toBottomOf="@+id/tab1" + app:layout_constraintStart_toEndOf="@+id/tab1" + app:layout_constraintTop_toTopOf="@+id/tab1" + tools:visibility="gone" /> - + - + - + - - - - - - + + + app:layout_constraintBottom_toBottomOf="@+id/tab2" + app:layout_constraintStart_toEndOf="@+id/tab2" + app:layout_constraintTop_toTopOf="@+id/tab2" + tools:visibility="gone" /> - + - + - + - + - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +