Ripple effect in Drawer items





Hello everyone Welcome! Today in this topic I'll show to you about how to use ripple effect in Drawer widget. Let's start :

1. Create a new project. In this new project add drawer from "View manager"



2.Now go to Drawer xml and design your drawer here




3. Now go to Moreblock and create a Moreblock named "Ripple" and add a view variable named "view"



4. Now paste the code with add source directly block

 android.graphics.drawable.RippleDrawable ripdr1 = new android.graphics.drawable.RippleDrawable(new android.content.res.ColorStateList(new int[][]{new int[]{}}, new int[]{Color.parseColor("#E0E0E0")}), new android.graphics.drawable.ColorDrawable(Color.parseColor("#FFFFFF")), null);
_view.setBackground(ripdr1);



5. Go to Drawer event and add your widget where you want to show ripple effect




6. Select your widget & save



7. Go to on create event and set this code with asd block to show ripple effect. You can change the widget id  
Code :        _Ripple(_drawer_linear1);    



8. Thats all, Save and Run your Project




Thanks for visiting. Please comment below if you feel any problem related to this topic.

4 comments:

  1. When Textview or imageview is clicked inside linearview.... Linearview doesn't show ripple effect??
    How to show ripple effect on linearview when imageview is clicked?

    ReplyDelete
    Replies
    1. I think you are using event listener of imageview or textview, if true please try to use event for the linear.
      Otherwise it should be working.

      Delete

Note: Only a member of this blog may post a comment.

Powered by Blogger.