1.tablayout中间添加竖线
(1).
LinearLayout linearLayout = (LinearLayout) tablayout.getChildAt(0);
linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
linearLayout.setDividerDrawable(ContextCompat.getDrawable(this,R.drawable.line));
linearLayout.setDividerPadding(30);
(2).R.drawable.line
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#e6e6e6"/>
<size android:width="1dp"/> <---这行很重要->
</shape>
2.tablayout下划线
app:tabIndicatorColor="#5377FF" <--tablayout指示器颜色-->
app:tabRippleColor="@android:color/transparent" <--取消点击阴影效果-->
//代码实现取消点击阴影效果
TabLayout.setTabRippleColor(null);
app:tabIndicator="@null" <--取消指示器-->
//代码实现取消指示器
tablayout.setSelectedTabIndicatorHeight(0);