android TabLayout设置选项卡之间的距离无效已解决
根据下面的链接设置完距离后无法生效
https://www.jb51.net/article/131304.htm
layout
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabDots"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-100dp"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorGravity="center"
app:tabIndicatorHeight="0dp"
app:tabMode="fixed"
app:tabMaxWidth="80dp"
app:tabMinWidth="20dp"
app:tabPaddingStart="20dp"
app:tabPaddingEnd="20dp"
/>
tab_selector.xml
xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/selected_dot" android:state_selected="true" />
<item android:drawable="@drawable/default_dot" />
</selector>
selected_dot.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="8dp"
android:useLevel="false">
<solid android:color="#FFFFFF"/>
</shape>
</item>
</layer-list>
default_dot.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="8dp"
android:useLevel="false">
<solid android:color="#66FFFFFF"/>
</shape>
</item>
</layer-list>
把下面这四个属性设置后就好了
app:tabMaxWidth="80dp"
app:tabMinWidth="20dp"
app:tabPaddingStart="20dp"
app:tabPaddingEnd="20dp"