如何将TabLayout背景设置为透明 [英] How to set TabLayout background to transparent
本文介绍了如何将TabLayout背景设置为透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将TabLayout(扩展HorizontalScrollView)背景更改为透明,而无需更改样式的原色.如果我将背景设置为#00000000,它将变为primaryColor.如果我将alpha设置为0-我将得到相同的行为.
I need to change TabLayout (extending HorizontalScrollView) background to transparent without changing primary color from styles. If I set a background to #00000000 it becomes primaryColor. If I set alpha to 0 - I get the same behavior.
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:hapticFeedbackEnabled="true"/>
是否可以在不更改样式颜色的情况下将背景颜色设置为透明?
Is there any way to set background color transparent without changing styles colors?
推荐答案
使用:
android:background="@android:color/transparent"
也在AppBarLayout中.要删除阴影以使其看起来更好,您可以使用以下方法删除AppBarlayout的高程:
also in the AppBarLayout. to remove the shadow to make look better you can remove the elevation of the AppBarlayout with:
app:elevation="0dp"
这篇关于如何将TabLayout背景设置为透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文