设置分割线
LinearLayout ll = (LinearLayout) tab.getChildAt(0);
ll.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
ll.setDividerPadding(16);//设置分隔器两端的填充
ll.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.tab_shape));
自定义XML属性
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#D6D8DA"/>
<size android:width="1dp"/>
</shape>