我需要为工具栏或卡片视图提供弯曲的底视图。
我尝试过的:
bg_toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" />
</item>
<item
android:bottom="0dp"
android:left="-100dp"
android:right="-100dp"
android:top="-80dp">
<shape android:shape="oval">
<solid android:color="@color/colorAccent" />
</shape>
</item>
</layer-list>
将其设置为工具栏的背景会使应用栏高度(阴影)无效。此外,如果将此背景应用于设置的 CardView 背景,但阴影不根据背景的形状。
请参见下图,我希望阴影环绕曲线。
我已经使用 arcView 完成了此操作
依赖实现 'com.github.florent37:shapeofview:1.3.2'
<com.github.florent37.shapeofview.shapes.ArcView
android:layout_width="match_parent"
android:layout_height="155dp"
android:elevation="5.0dp"
app:shape_arc_cropDirection="outside"
app:shape_arc_height="35dp"
app:shape_arc_position="bottom">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="155dp"
android:background="@color/colorPrimary"
android:elevation="5dp" />
</com.github.florent37.shapeofview.shapes.ArcView>
检查附图
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)