1.自定义分割线
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/public_line_color"/>
<size android:width="1px" />
</shape>
2.添加分割线
/**
* 给tablayout 添加分割线
*/
public static void addDivider(TabLayout tabLayout,int padding){
LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
linearLayout.setDividerDrawable(ContextCompat.getDrawable(getContext(),
R.drawable.layout_divider_vertical));
linearLayout.setDividerPadding(CommonUtils.dip2px(getContext(),padding));
}