文章目录
问题描述
自定义的TabLayout在xml里面设置好,或者在代码里面自己添加好自定义的Tab后, 再结合 TabLayoutMediator关联ViewPage2, 发现Tablayout自定义的Tab都消失不见了…
代码展示
customer_tab_item.xml
自定义Tab 的xml代码
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">
<TextView
android:id="@+id/customer_tab_text"
style="@style/customer_tab_item_text_style"
android:layout_width="123dp"
android:layout_height="0dp"
android:layout_marginTop="12dp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="@+id/lottieAnimationView"
app:layout_constraintHorizontal_bias="0.494"
app:layout_constraintStart_toStartOf