[英]AppBarLayout and Toolbar set no shadow
I have AppBarLayout
and Toolbar
in acitivty and TabLayout
into my Fragment.我的 Fragment 中有AppBarLayout
和Toolbar
in acitivty 和TabLayout
。 How can I set my toolbar shadow to zero so it would be smooth place between toolbar and tablayout?如何将我的工具栏阴影设置为零,以便在工具栏和 tablayout 之间平滑放置?
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:theme="@style/SDK.Theme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
app:elevation="0dp"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
You can remove the shadow programatically.您可以以编程方式删除阴影。
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
appBar.setElevation(0);
}
Where appBar
is your AppBarLayout
.其中appBar
是您的AppBarLayout
。
EDIT:编辑:
I've just noticed you use android:elevation="0dp"
attribute.我刚刚注意到您使用了android:elevation="0dp"
属性。 Use app:elevation="0dp"
if you want to do it via xml.如果您想通过 xml 执行此操作,请使用app:elevation="0dp"
。
如果您想尝试,这也有效。
appBarLayout.isEnabled = false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.