dimanche 10 mai 2015

android ripple effect not effecting the child views

Hi I have a ripple effect drawable something like this

<?xml version="1.0" encoding="utf-8"?> 
<ripple  xmlns:android="http://ift.tt/nIICcg"
android:color="@color/ripple_material_light">
<item android:id="@android:id/mask"
    android:drawable="@android:color/white" />
 </ripple>

and I am adding it to the background of my LinearLayout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/touch_ripple"
android:clickable="true"
android:orientation="horizontal">

<ImageView
    android:id="@+id/item_left_nav_drawer_recycle_view_image_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="16dp"
    android:gravity="center_vertical" />

<TextView
    android:id="@+id/item_left_nav_drawer_recycle_view_text_view"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:fontFamily="@string/font_fontFamily_medium"
    android:textSize="14sp"
    android:layout_margin="16dp"
    android:gravity="center_vertical" />
</LinearLayout>

So I added it to the background of linearlayout. When I click on the item it shows the ripple effect but the ripple effect is not being shown on the textview and imageview their background stays white and the ripples doesnt pass through them. I tried to add the drawable to all child views too but I have like 3 ripples everytime I touch on the item.

How can I make the ripple to effect the whole list item

Aucun commentaire:

Enregistrer un commentaire