自定义tablayout中的tab样式

其中layout的布局文件;

xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">

            android:id="@+id/tab_text"
        android:text="11"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#f00"
        android:textColor="#ff0"
        android:textSize="24sp" />

mainctivity布局:

xml version="1.0" encoding="utf-8"?>
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="match_parent"
    tools:context="com.example.zhangjiqun.aninterface.MainActivity">

    
        android:id="@+id/tl_b"
        app:tabPadding="0dp"
        app:tabGravity="fill"
        app:tabIndicatorColor="#00f"
        app:tabIndicatorHeight="4dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    
            android:id="@+id/vp_b"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    



你可能感兴趣的:(自定义tablayout中的tab样式)