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" /> - + - + - + - + - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +