TabLayout实现自定义标题栏目功能
1、前提
在平时的工作中,大家都会使用到TabLayout,默认情况下TabLayout支持文字的,需要支持图文或者自定义就需要自己来写了。
先上一张图:
2、直接上代码
布局文件
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="0pt"
android:layout_height="150pt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view_linear_bill"
android:background="@color/color_ffffff"
app:tabContentStart="20p