android - Add a shadow over the bottom of the ImageView in CordinatorLayout -


recently implementing material design existing application. using following library : http://android-developers.blogspot.com/2015/05/android-design-support-library.html achieve following effect : https://plus.google.com/+androiddevelopers/posts/xudgfs9eyxg.

my layout code below:

<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">      <android.support.design.widget.appbarlayout         android:id="@+id/appbar"         android:layout_width="match_parent"         android:layout_height="350dp"         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:contentscrim="?attr/colorprimary"             app:expandedtitlemarginbottom="32dp"             app:expandedtitlemarginend="64dp"             app:expandedtitlemarginstart="48dp"             app:layout_scrollflags="scroll|exituntilcollapsed">              <imageview                 android:id="@+id/event_image"                 android:layout_width="fill_parent"                 android:layout_height="350dp"                 android:background="@color/white"                 android:fitssystemwindows="true"                 android:scaletype="centercrop"                 app:layout_collapsemode="parallax" />              <android.support.v7.widget.toolbar                 android:id="@+id/anim_toolbar"                 android:layout_width="match_parent"                 android:layout_height="?attr/actionbarsize"                 app:layout_collapsemode="pin"                 app:popuptheme="@style/themeoverlay.appcompat.light" />         </android.support.design.widget.collapsingtoolbarlayout>     </android.support.design.widget.appbarlayout>      <android.support.v4.widget.nestedscrollview  --------     </android.support.v4.widget.nestedscrollview>      <android.support.design.widget.floatingactionbutton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_margin="30dp"         android:clickable="true"         android:src="@drawable/ic_action_share"         app:layout_anchor="@+id/appbar"         app:layout_anchorgravity="bottom|right|end" />  </android.support.design.widget.coordinatorlayout> 

i achieve desired effect have problem image , text. text white color , when happens have image in part of consist of white color, text label cannot read.

any suggestion how solve it, without destroying effect?

thanks @m vai giving me hint, used approach. create framelayout , inside put imageview , gradientview. passed animation attributes framelayout. quite simple @ end. instead of imageview should following code:

  <framelayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 app:layout_collapsemode="parallax"                 android:fitssystemwindows="true">                  <relativelayout                     android:id="@+id/title_layout"                     android:layout_width="fill_parent"                     android:layout_height="wrap_content">                      <imageview                         android:id="@+id/event_image"                         android:layout_width="fill_parent"                         android:layout_height="350dp"                         android:background="@color/white"                         android:scaletype="centercrop"                        />                  </relativelayout>                  <view                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:background="@drawable/actionbar_overlay" />             </framelayout> 

the xml file below:

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"        android:shape="rectangle">      <size android:height="100dp"/>      <gradient         android:angle="270"         android:startcolor="#0000"         android:endcolor="#b000"/>  </shape> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -