android - ripple to an ImageButton not working -


i trying add ripple on image button won't work

<imagebutton     android:id="@+id/imagebutton"     android:layout_width="250dp"     android:layout_height="60dp"     android:layout_alignparentbottom="true"     android:layout_centerhorizontal="true"     android:layout_marginbottom="139dp"     android:background="@drawable/googleback"     android:scaletype="fitxy"     android:src="@drawable/google" /> 

this ripple code

<?xml version="1.0" encoding="utf-8"?>  <ripple android:color="#fafafa"> <item android:id="@android:id/mask">     <shape android:shape="rectangle">         <solid android:color="?android:attr/colorcontrolhighlight" />     </shape> </item> </ripple> 

  1. your code incomplete
  2. ripple works in android 5.0. sure you're running app on 5.0 or newer version of avd ?

according android l's ripple effect - touch feedback buttons - using xml, should set button ripple effect this:

<imagebutton       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:background="@drawable/ripple"/> 

ripple.xml

<ripple xmlns:android="http://schemas.android.com/apk/res/android"                        android:color="?android:colorcontrolhighlight">         <item android:id="@android:id/mask">             <shape android:shape="oval">                 <solid android:color="?android:coloraccent" />             </shape>         </item>  </ripple> 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -