How to change TextView background color when touching in and out of view?
Posted
by
MikeShiny
on Stack Overflow
See other posts from Stack Overflow
or by MikeShiny
Published on 2012-09-23T21:34:43Z
Indexed on
2012/09/23
21:37 UTC
Read the original article
Hit count: 223
This has to be a very simple fix, but I can't seem to figure it out. I have got my program to change the background color to change onClick, and onTouch with ACTION_DOWN and ACTION_UP. But I need it to change the color when touching the screen and going in and out of the TextView. I need it to function like a mouseOver/mouseOut event. Is there a way to do this on android? Or am I stuck with onTouch, where the action has to start from within the TextView?
Right now I set the onTouch Listener on the textview itself. Should I set it somewhere else and then check if the x and y are within the Textview? Or is there another event listener I should be using? I am new to Android, any help would be appreciated. Thanks.
Mike
© Stack Overflow or respective owner