Android Custom Button Ripple/pulse Effect -


i have created custom circular button using following :

    <button     android:id ="@+id/startbutton"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="start"     android:background="@drawable/button_bg_round"     android:padding="15dp"     android:textsize="30sp"     android:textstyle="bold"     android:textcolor="#ffffff"     android:layout_centervertical="true"     android:layout_centerhorizontal="true" /> 

here button_bg_round defined below :

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item>     <shape android:shape="oval">         <stroke android:color="#ffffff" android:width="5dp" />         <solid android:color="#3aeaee"/>         <size android:width="200dp" android:height="200dp"/>     </shape> </item> </selector> 

now, want add circular ripple/pulse effect/animation when button clicked. tried possible solution on google , couldn't find related such button. appreciated.

you can make drawable this:

<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:color="@color/coloraccent"     tools:targetapi="lollipop"> <!-- ripple effect color -->     <item android:id="@android:id/background">         <shape android:shape="oval">             <stroke android:color="#ffffff" android:width="5dp" />             <solid android:color="#3aeaee"/>             <size android:width="200dp" android:height="200dp"/>         </shape>     </item> </ripple> 

where android:color inside ripple color of effect.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -