tablayout设置点击tab时的背景色

2020-01-09  本文已影响0人  头发依然在
tabLayout.setTabRippleColor(ColorStateList.valueOf(getResources().getColor(R.color.color_transparent)));

//或者可以从xml中修改:
app:tabRippleColor="@color/color_transparent"

源码解释的意思

 /**
   * Sets the ripple color for this TabLayout.//修改布局的涟漪颜色
   *
   * <p>When running on devices with KitKat or below, we draw this color as a filled overlay rather
   * than a ripple.
   *
   * @param color color (or ColorStateList) to use for the ripple
   * @attr ref com.google.android.material.R.styleable#TabLayout_tabRippleColor
   * @see #getTabRippleColor()
   */

注:仅以记录学习使用,如有错误,欢迎指出,互相学习

上一篇 下一篇

猜你喜欢

热点阅读