Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to apply Ripple Animation in Android XML file

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.08k
    Comment on it

    If you want to implement Ripple effect for buttons and other views, then this tutorial is helpfull for you. Ripple is like a wave, when user interact with the UI elements, material design provides a visual effect at the point of contact. Ripple animation makes a instant visual confirmation at the mind of user, that the event is occured. The ripple effect can be configured to end at the bounds of the view or extend beyond the bounds of the view.


    Apply this functionality in your view:-
    selectableItemBackground for a bounded ripple.

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?android:attr/selectableItemBackground"/>
    

    selectableItemBackgroundBorderless for a ripple that extends beyond the view. It will be borderless to its own view, and bounded by, the nearest parent of the view with a non-null background.

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?android:attr/selectableItemBackgroundBorderless"/>
    

    The view returns to its original position after the ripple animation is completed.
    selectableItemBackground and selectableItemBackgroundBorderless are introduced in android API level 21+.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: