Problem description:
I have a TextView
on a RelativeLayout
and I want to color it red when the user touches it, and go on another page when he clicks on it.
So I tried to set an OnClickListener
to do the click, and an OnTouchListener
to implement the touch function (MotionEvent.ACTION_DOWN
) but this combination doesn't work, because OnTouchListener
makes OnClickListener
non-functional (don't know why).
On forums people say that we can implement the OnClick
by the OnTouch MotionEvent.ACTION_UP
, but this one can be triggered out of my TextView
layout (the TextView gonna be clicked if you press it and drag your finger out of him to release) and this is not the desired behavior because I want:
click = press + release on the TextView.
Can someone give me a solution for this please?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…