我有CollapsingToolbar
标题图片。我想在图像上添加阴影,而不是在下面。我尝试了app:elevation
参数,但没有效果。
截图:
代码:
<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:fitsSystemWindows="true">
<include layout="@layout/detail_content"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:statusBarScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/imageViewToolbar"
android:minHeight="500dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:layout_collapseMode="parallax" />
<ProgressBar
android:layout_gravity="center_vertical"
android:id="@+id/progress"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="50dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:title=""
android:layout_width="match_parent"
android:layout_height="300dp"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fullscreenFAB"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_margin="32dp"
android:layout_gravity="center_vertical|left"
android:clickable="true"
app:fabSize="normal"
android:background="@color/colorPrimary"
app:layout_anchor="@+id/collapsing_toolbar"
app:layout_anchorGravity="bottom|right"
android:src="@drawable/ic_fullscreen_black_24dp"/>
答案 0 :(得分:0)
您可以将ImageVIew和ProgressBar放入RelativeLayout并添加带阴影背景的视图:
prettier-eslint
同时在drawable文件夹中创建一个“gradient.xml”文件:
setOptions={{firstLineNumber: 10}}