Tablayout.setSelectedTabIndicato

作者: 九狼JIULANG | 来源:发表于2021-02-26 21:13 被阅读0次

Tablayou的指示器setSelectedTabIndicator不显示了

网上说是变量改了

解决方法在xml里添加此代码

    app:tabIndicator="@drawable/tabs_rounded_line_indicator"

tabs_rounded_line_indicator.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:left="4dp"
        android:right="4dp">
        <shape
            android:shape="rectangle">
            <solid android:color="?attr/main_bg_color"/>
            <corners
                android:bottomLeftRadius="0dp"
                android:bottomRightRadius="0dp"
                android:topLeftRadius="3dp"
                android:topRightRadius="3dp"/>
            <size
                android:height="3dp"/>
        </shape>
    </item>
</layer-list>

  指示器宽度跟随文本宽度

app:tabIndicatorFullWidth="false"

不放效果图的一律当水帖处理

效果图

相关文章

网友评论

    本文标题:Tablayout.setSelectedTabIndicato

    本文链接:https://www.haomeiwen.com/subject/hrmvfltx.html