取消按Tab布局中的突出显示 [英] Remove highlight on press in tablayout

查看:70
本文介绍了取消按Tab布局中的突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在按下选项卡时禁用此突出显示.我已经搜索了半个小时,无法解决.我正在使用TabLayout.

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.

推荐答案

只需将背景颜色设置为透明或TabLayout的背景颜色即可.将以下代码添加到父布局.

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"

然后将以下内容添加到tablayout中.

And add the following to tablayout.

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

这将解决您的问题.在Android M中进行了测试.

This will solve your problem. Tested in Android M.

这篇关于取消按Tab布局中的突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆