0

I have a navigation drawer full of items in its listview, as well as a linearlayout on the bottom of the drawer which acts as another option. When any of the items in the list are clicked, their containers animate nicely with the material ripple effect. I want to know how to enable the same effect on the linearlayout button outside of the list.

Brandon Slaght
  • 1,025
  • 1
  • 12
  • 34
  • 1
    You can try this.. http://stackoverflow.com/a/19780767/3209739 It gives ripple effect. – cgr Dec 03 '15 at 19:55

1 Answers1

0

In drawable and drawable V21 folder, create two xml files with same name(for eg animation_xml.xml) and the logic here is whenever the SDK version>=LOLLIOP it will take value from drawableV21 and LOLLIPOP<= then it will take value from Drawable,

And you should set Button background as Drawable.

For ripple Effect: animation_xml.xml

 <ripple android:color="#ff0000ff">
   <item android:drawable="@drawable/my_drawable" />
 </ripple>

and for normal: animation_xml.xml

<shape>
<solid android:color="#ff0000ff"/>
</shape>

for more info use: Ripple Animation guide

androgo
  • 564
  • 2
  • 8