Wednesday, 30 December 2015

XML : Ripple effect goes beneath image

I implemented the Ripple effect on a RelativeLayout. Created the Ripple drawable and set my layout's background as the drawable. The problem is that when I hold the layout , the ripple effect goes beneath the image. I want it to affect the image too. How can I do it?

Layout :

   <RelativeLayout              android:layout_width="match_parent"              android:layout_marginRight="15dp"              android:layout_marginLeft="15dp"              android:layout_height="wrap_content"              android:elevation="2dp"              android:id="@+id/relativelayout_currentmeal"              android:layout_marginTop="10dp"              android:layout_marginBottom="10dp"              android:background="@drawable/layout_diet">                <TextView                  android:layout_width="wrap_content"                  android:layout_height="wrap_content"                  android:text="رژیم امروز (دوشنبه) :"                  android:layout_marginRight="10dp"                  android:layout_marginTop="10dp"                  android:textColor="@android:color/black"                  android:id="@+id/textview_currentday_diet"                  android:layout_alignParentTop="true"                  android:layout_alignParentRight="true"                  android:layout_alignParentEnd="true" />                <TextView                  android:layout_width="wrap_content"                  android:layout_height="wrap_content"                  android:text="صبحانه"                  android:textColor="@color/colorPrimaryDark"                  android:textSize="30sp"                  android:id="@+id/textview_mealtype"                  android:layout_below="@+id/textview_currentday_diet"                  android:layout_centerHorizontal="true"                  android:layout_marginTop="08dp"                  android:clickable="true"                />                <TextView                  android:layout_width="match_parent"                  android:layout_height="wrap_content"                  android:text="شام امشب شما ، 2 عدد نیمرو به همراه 55 گرم نان بربری یا لواش است ! سعی کنید به رژیم تان پایبند بمانید!"                  android:id="@+id/textview_currentmeal"                  android:layout_below="@+id/textview_mealtype"                  android:layout_marginBottom="10dp"                  android:layout_marginRight="10dp"                  android:layout_marginLeft="10dp"                  android:textColor="@android:color/black"                  android:textSize="15sp"                  android:layout_centerHorizontal="true"                  android:layout_marginTop="10dp" />                <ImageView                  android:layout_width="fill_parent"                  android:layout_height="wrap_content"                  android:layout_marginBottom="-30dp"                  android:src="@mipmap/imgdiet4"                  android:layout_below="@id/textview_currentmeal"/>              </RelativeLayout>    

Drawable :

  <?xml version="1.0" encoding="utf-8"?>    
  <item android:id="@android:id/mask" android:drawable="@android:color/white"></item>    <item>      <color android:color="@android:color/white"></color>  </item>    

The Ripple Image On The Layout

No comments:

Post a Comment