StupidBeauty
Read times:2537Posted at: - no title specified

转载 How does “?android:attr/activatedBackgroundIndicator” work?

在ListView中,使用selector来切换列表中各个条目在不同状态下的背景时,应当使用 android:state_activated = "true" 来表示条目被选中时的状态。

http://stackoverflow.com/questions/15008150/how-does-androidattr-activatedbackgroundindicator-work

亮点:

If you open that file you will see the definition of the drawable which is important to understanding what is going on.

<selector xmlns:android = "http://schemas.android.com/apk/res/android" >

<item android:state_activated = "true" android:drawable = "@android:drawable/list_selector_background_selected" />

<item android:drawable = "@color/transparent" />

</selector>

Here we are defining a drawable with two states - default state is just transparent background and if the state is "state_activated" then our drawable is "list_selector_background_selected".

see  this link  for background information on on drawables and states.

Your opinions

Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands