Hi,
I made a custom widget (which is just a composite like):
<LinearLayout>
<TextView>
</LinearLayout>
this widget is focusable and reacts to touches. I'd like it to change
its background color to the default system highlight color when the
user scrolls to it, and have it blink when the user taps it (just like
an element of a ListView does).
I can add an OnFocusChangeListener for when the user scrolls to it,
and in the handler do the changing of the background color.
How would I add the 'blinking' behavior though when the user just taps
it with a finger? I did something like this as a test:
setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// Requesting focus triggers my OnFocusChangeListener which
changes the bg color.
requestFocusFromTouch();
new Handler().postDelayed(new Runnable() {
public void run() {
clearFocus();
}
}, 300);
return false;
}
});
this is just a guess. Is there a correct way of implementing this
behavior?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---