美文网首页
tablayout设置点击tab时的背景色

tablayout设置点击tab时的背景色

作者: 头发依然在 | 来源:发表于2020-01-09 16:48 被阅读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()
   */

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

相关文章

网友评论

      本文标题:tablayout设置点击tab时的背景色

      本文链接:https://www.haomeiwen.com/subject/txayactx.html