我需要将TabLayout(扩展HorizontalScrollView)背景更改为透明而不更改样式的基色.
如果我将背景设置为#00000000,它将变为primaryColor.如果我将alpha设置为0 – 我会得到相同的行为.
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:hapticFeedbackEnabled="true"/>
有没有办法在不改变样式颜色的情况下将背景颜色设置为透明?
解决方法:
如果您使用的是< android.support.design.widget.AppBarLayout />,则必须在其外部插入TabLayout.
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/app_bar"
......
android:background="@color/app_bar_color"
app:layout_scrollFlags="scroll|enterAlways" />
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:hapticFeedbackEnabled="true"/>
标签:android,tabs
来源: https://codeday.me/bug/20190611/1221741.html