在线性布局上有长按过渡动画效果

时间:2013-05-18 20:25:53

标签: android

参考Android: How to achieve the glow effect when long-pressing a list item?

通过在线性布局的背景上应用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>

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

还有什么我错过了吗?

0 个答案:

没有答案