TabPageIndicator 分割线

在使用TabPageIndicator自定义样式时,样式如下

<!-- 指示器样式主题 -->
    <style name="StyledIndicators" parent="@style/ActivityTheme">
        <item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item>
    </style>
    <!-- 选项卡自定义样式 -->
    <style name="CustomTabPageIndicator">
        <item name="android:gravity">center</item>
        <item name="android:background">@drawable/tab_indicator</item>
        <item name="android:textColor">@color/tag_text_color_selector</item>
        <item name="android:textSize">@dimen/font_1</item>
        <item name="android:minHeight">45dp</item>
        <item name="android:divider">@drawable/icon_line</item>
        <item name="android:showDividers">middle</item>
    </style>

在定义android:divider时,本来以为使用color简单设置就可以了,但是发现设置之后不显示(版本4.0以上),后来换成使用drawable,但是又不像让美工切图(求人不如求己),就想着自定义一个shape xml.

首先想到是定义一个line shape

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line">
    <size  android:width="1dp"/>
    <stroke android:color="#123456" android:width="1dp"/>
</shape>

但是效果却是一横线,我要的是竖线啊,大哥!不管我如何修改size 的宽高,它始终是一横线。。。。
后来改用了矩形

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <size
        android:width="1dp"
        android:height="45dp" />
    <gradient
        android:endColor="#f7f7f7"
        android:startColor="#f7f7f7" />
</shape>

设置好宽高,让它像一条线。。。。ok,解决。。。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值