Ответ 1
Я знаю, что теневая форма не имеет такого же внешнего вида, как высота, но, по крайней мере, дайте ей попробовать. Фокус в том, чтобы использовать app:layout_anchor
, чтобы закрепить тень на нижнем листе.
activity_main.xml
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="16dp"
android:background="@drawable/shape_gradient_top_shadow"
app:layout_anchor="@id/bottom_sheet" />
<FrameLayout
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="200dp"
android:clipToPadding="false"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior" />
</android.support.design.widget.CoordinatorLayout>
shape_gradient_top_shadow.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="@android:color/transparent"
android:startColor="#64000000"/>
</shape>
Похож:
ИЗМЕНИТЬ
Получите еще лучший результат с помощью настраиваемого ShadowView
:
- Сообщение от Roman Nurik по этой теме: https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf
- Gist
ShadowView
на основе решения Roman Nurik: https://gist.github.com/MariusBoepple/bf869e02541cd4750550e88fa07b5ddd
Затем вы можете сделать следующее:
<ShadowView
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="16dp"
android:gravity="bottom"
app:layout_anchor="@id/bottom_sheet" />