Remove highlight on press in tablayout

我是研究僧i 提交于 2019-11-30 04:44:00

问题


How to disable this highlight on pressing the tab. I have been searching for half an hour and couldn't figure it out. I am using tablayout.


回答1:


just set the background color to transparent or to the background color of the tablayout. Add the following code to the parent layout.

 xmlns:app="http://schemas.android.com/apk/res-auto"

And add the following to tablayout.

app:tabBackground="?attr/colorPrimary"
android:background="?attr/colorPrimary"

This will solve your problem. Tested in Android M.




回答2:


Add the below line to your XML:

app:tabRippleColor="@android:color/transparent"


来源:https://stackoverflow.com/questions/37866240/remove-highlight-on-press-in-tablayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!