Hello all,

I have a situation where I need to make a TextView focusable and
clickable for a dynamically generated activity (so I'm not using XML
in this case).  I've accomplished this with setClickable(true) and
setFocusable(true) and successfully capture onClick() for the
TextView.  However, when navigating through the interface with the D-
pad, and focus goes onto the TextView from the other controls, there
is no color change indication.  I assume this is because TextView is
not normally focusable.  Unfortunately, this would be confusing to a
user.

How can I mimic the focus color change of the other controls on my
TextView?  Do I need to capture onWindowFocusChanged() myself and then
adjust the color?  The key here is I want it to use the appropriate
color for the current theme and not set the color to a fixed value.

One thing I tried was this:

m_textviewTest.setTextColor(m_checkboxTest.getTextColors());

(m_textviewTest is the TextView and m_checkboxTest is another control
in the activity)
While this code changed the TextView's un-focused color to the
brighter white of checkbox text, focus still does not cause a change
it to the orange of the default theme.  I guess this makes sense,
though, because controls like checkbox and radiobuttons only change
the button's color when focused, and not the accompanying text.  There
seems to be very little information about ColorStateList and stateSets
so I don't know if I'm missing something there.

(Due to the design of this view, I could actually get away with just
making it clickable and not focusable so D-pad focus just skips by it,
but, unfortunately, even if it's clickable, if it's not also
focusable, the onClick() won't fire.)

Thanks for any assistance,
Greg
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to