TabLayoutUtil.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:RLibrary 作者:
public static void setCommonTabDivider(CommonTabLayout tabLayout, @ColorInt int color, int showDividers, int padding) {
    LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
    linearLayout.setDividerPadding(padding);
    RectShape rectShape = new RectShape();
    float density = tabLayout.getResources().getDisplayMetrics().density;
    ShapeDrawable shapeDrawable = new ShapeDrawable(rectShape);
    shapeDrawable.setIntrinsicWidth((int) density);
    shapeDrawable.setIntrinsicHeight((int) density);
    shapeDrawable.getPaint().setColor(color);
    shapeDrawable.getPaint().setStyle(Paint.Style.STROKE);
    linearLayout.setDividerDrawable(shapeDrawable);
    linearLayout.setShowDividers(showDividers);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号