[英]Design Support Library, Toolbar buttons cropped ripple
I'm trying to utilize the CoordinatorLayout, AppBarLayout, CollapsingToolbarLayout, Toolbar
and a parallax'ed ImageView
.我正在尝试利用
CoordinatorLayout, AppBarLayout, CollapsingToolbarLayout, Toolbar
和视差处理的ImageView
。 It looks like the ripple effect of the toolbar menu items is cropped.看起来工具栏菜单项的涟漪效果被裁剪了。 The following image displays the ripple effect of the back button in expanded and in partially collapsed mode.
下图显示了后退按钮在展开和部分折叠模式下的涟漪效果。 In complete collapsed mode the ripple effect is not shown at all.
在完全折叠模式下,根本不显示涟漪效应。 I think this is caused by the parallax'ed
ImageView
that is positioned there.我认为这是由定位在那里的视差
ImageView
引起的。
Layout:布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.view.ViewPager>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="224dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:weightSum="1.0">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="56dp"
android:layout_weight="1.0"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="48dp"
android:scaleType="centerInside"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.4"/>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:tabGravity="fill"
app:tabMode="fixed"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
The ImageView
displays a 9-patch
'ed Image. ImageView
显示一个9-patch
'ed Image。 Is there something wrong with the layout or is it a bug/inability in the design support library to draw the ripple ontop of the ImageView?布局有问题还是设计支持库中的错误/无法在 ImageView 上绘制波纹?
I think your solution is here .我认为您的解决方案就在这里。
You can try to add this line:您可以尝试添加此行:
<item name="actionBarItemBackground">?attr/selectableItemBackground</item>
in the theme/style of your Toolbar.在工具栏的主题/样式中。
If it doesn't work, add this in your Toolbar
attributes:如果它不起作用,请将其添加到您的
Toolbar
属性中:
android:background="@android:color/transparent"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.