Ripple effect in Drawer items
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
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);
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.
Nice
ReplyDelete👍
DeleteWhen Textview or imageview is clicked inside linearview.... Linearview doesn't show ripple effect??
ReplyDeleteHow to show ripple effect on linearview when imageview is clicked?
I think you are using event listener of imageview or textview, if true please try to use event for the linear.
DeleteOtherwise it should be working.