I have a TextView inside a LinearLayout . LinearLayout can receive focus, and I want the textColor TextView change when it does. I thought using a ColorStateList would work, but it would seem that the TextView does not get focus when doing LinearLayout . I know this because I tried this code:
mTextView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { Log.d(TAG, "Changed TextView focus to: " + hasFocus); } });
And nothing is registered. I do not want to use OnFocusChangeListener in LinearLayout to change textColor for TextView , I think it needs to be done from XML. The reason for this is that in another event, I have an ExpandableListView with a custom adapter and custom views, and Android changes the textColor TextView (from light to dark) inside my custom views when the objects are focused.
java android themes focus
Felix
source share