【问题标题】:Android Material Tab Layout indicator with round corners带圆角的 Android 材质选项卡布局指示器
【发布时间】:2021-10-18 04:34:38
【问题描述】:

如何制作带圆角的材质选项卡布局指示器

参考图片

【问题讨论】:

    标签: android material-components-android material-components


    【解决方案1】:

    使用此app:tabIndicator 属性自定义选项卡指示器。

    像下面这样创建可绘制对象

    indicator.xml

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
            <shape android:shape="rectangle">
                <corners android:topRightRadius="5dp"
                    android:topLeftRadius="5dp"/>
                <solid android:color="@color/color_text_black" />
            </shape>
        </item>
    </layer-list>
    

    像下面这样使用上面的 XML

    app:tabIndicator="@drawable/indicator"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 2023-03-28
      • 2019-08-25
      • 2018-05-08
      • 1970-01-01
      • 2014-12-21
      • 1970-01-01
      相关资源
      最近更新 更多