本文介绍了如何将 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 背景设置为透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!