5

参考Android:如何实现长按列表项的发光效果?

通过应用list_selector_holo_light.xml线性布局的背景(ListView 中没有使用),我想我可以通过长按来实现发光的动画效果。

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

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

    <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
    <item android:state_focused="true"  android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
    <item android:state_focused="true"  android:state_enabled="false"                              android:drawable="@drawable/list_selector_disabled_holo_light" />
    <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_light" />
    <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_light" />
    <item android:state_focused="true"                                                             android:drawable="@drawable/list_focused_holo" />

</selector>

但是,我没有看到过渡动画效果,从浅蓝色过渡到深蓝色。

还有什么我错过的吗?

4

0 回答 0