-2
在使用工具栏时,我正面临棒棒糖&预棒棒糖设备的一些麻烦。阴影未显示,所以我已经看到,获取阴影的最常见方法是添加具有渐变的视图。布局视图始终在结束
这是我的布局:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/container_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
</LinearLayout>
<FrameLayout
android:id="@+id/container_body"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/toolbar_dropshadow" />
</FrameLayout>
</LinearLayout>
凡toolbar_dropshadow是:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@android:color/transparent"
android:endColor="#88333333"
android:angle="90"/>
</shape>
这样的shafow在大多数情况下显示良好,但也有在阴影隐藏少数病例。在1个片段中,我在工具栏下方有一个Map(Googlemap),所以当它更新时,阴影消失。另外,在其他片段中,我在工具栏下方有一个imageview,当图像加载时,阴影消失。
那么,有没有一种方法可以告诉阴影视图始终位于顶部,即使片段已被编程更新?