[英]Remove the shadow below TabLayout on android
我正在尝试在使用 TabLayout 时删除选项卡下方的阴影,它是在正常布局中定义的(而不是作为工具栏或操作栏的一部分)。
将主题设置为
<item name="android:windowContentOverlay">@null<item/>
或者
<item name="windowContentOverlay">@null<item/>
没用。
此外,将高度设置为 0 也无济于事。
<android.support.design.widget.TabLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@android:color/white"
app:backgroundTint="@android:color/transparent"
app:tabIndicatorColor="@android:color/transparent"
app:tabMode="scrollable"/>
我假设您的TabLayout
在AppBarLayout
内,该阴影带有AppBarLayout
,将此app:elevation="0dp"
添加到该小部件,我相信您对 go 很好。
我尝试app:elevation="0dp"
工作和android:elevation="0dp"
在AppBarLayout
中不起作用
我必须将海拔设置为 0dp,我还将AppBarLayout
的主题更改为@style/Base.Widget.Design.TabLayout
它对我有用
在你的活动上写这个
supportActionBar?.elevation = 0f
把getSupportActionBar().setElevation(0);
在 MainActivity java 文件中,如下所示:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setElevation(0);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.