Skip to content Skip to sidebar Skip to footer

Ripple Effect On Textview Long Click

How do I get a TextView to ripple on long click? It ripples fine onClick but I need the ripple for onLongClick.

Solution 1:

You can use Android Ripple Background

final RippleBackground rippleBackground=(RippleBackground)findViewById(R.id.content);
    ImageView imageView=(ImageView)findViewById(R.id.centerImage);
    imageView.setOnLongClickListener(newView.OnLongClickListener() {
            @OverridepublicbooleanonLongClick(View v) {
                rippleBackground.startRippleAnimation();
                returnfalse;
            }
        });

Solution 2:

There are many ways to implement a longClickListener this is one. Basicly an event is fired examples mouseover, onclick, onlongclick, onlistitemclick and listeners that "hear" the event. post the code if you need more help, did you have new OnLongClickListener() object created?

Post a Comment for "Ripple Effect On Textview Long Click"