how to change font color in selected/focused ListView items?

前端 未结 5 1461
心在旅途
心在旅途 2020-12-13 02:00

I am struggling with this which apparently is a very simple effect but incredibly haven\'t found any intutitive way for doing it in Android.

I have a ListView and I

5条回答
  •  独厮守ぢ
    2020-12-13 02:39

    When you are deploying the app for Android 11+ (HoneyComb+), you should use

    android:state_activated="true"
    

    for selected list state. For the earlier versions use the combination of:

    android:state_checked="true"
    android:state_activated="true"
    

    Of course don't forget to include the

    android:duplicateParentState="true"
    

    so the view can get the activated/checked state from a parent list view item

提交回复
热议问题