What is the difference between the states selected, checked and activated in Android?

前端 未结 3 1506
面向向阳花
面向向阳花 2020-11-29 15:26

I\'d like to know what differs those states. I didn\'t find any webpage clarifying this.

3条回答
  •  情话喂你
    2020-11-29 16:07

    According to the doc:

    • android:state_selected Boolean. "true" if this item should be used when the object is the current user selection when navigating with a directional control (such as when navigating through a list with a d-pad); "false" if this item should be used when the object is not selected. The selected state is used when focus (android:state_focused) is not sufficient (such as when list view has focus and an item within it is selected with a d-pad).

    • android:state_checked Boolean. "true" if this item should be used when the object is checked; "false" if it should be used when the object is un-checked.

    • android:state_activated Boolean. "true" if this item should be used when the object is activated as the persistent selection (such as to "highlight" the previously selected list item in a persistent navigation view); "false" if it should be used when the object is not activated. Introduced in API level 11.

    I think the doc is pretty clear, so what's the problem ?

提交回复
热议问题