Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android列表选择器在使用Theme.Light时卡住_Android_Listview - Fatal编程技术网

Android列表选择器在使用Theme.Light时卡住

Android列表选择器在使用Theme.Light时卡住,android,listview,Android,Listview,我有一个ListView,我的活动使用Theme.Light,但是当用户点击一个列表项时,我的列表选择器会被卡住,直到用户点击其他地方。当我使用默认主题时,不会发生这种情况 首先我遇到了这个问题:现在我又碰到了另一个问题。谷歌,那边发生了什么 这是一个非常恼人的问题,出于某种原因可能与您使用的主题有关。我不确定根本原因到底是什么,但这里有一个变通方法(存在于Android平台本身中)对我有效 <!-- Even though these two point to the same reso

我有一个ListView,我的活动使用Theme.Light,但是当用户点击一个列表项时,我的列表选择器会被卡住,直到用户点击其他地方。当我使用默认主题时,不会发生这种情况


首先我遇到了这个问题:现在我又碰到了另一个问题。谷歌,那边发生了什么

这是一个非常恼人的问题,出于某种原因可能与您使用的主题有关。我不确定根本原因到底是什么,但这里有一个变通方法(存在于Android平台本身中)对我有效

<!-- 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_pressed="true"
        android:drawable="@drawable/list_selector_background_transition" />
    <item android:state_focused="false" android:state_pressed="true"
        android:drawable="@drawable/list_selector_background_transition" />

(取自list_selector_background.xml)

请注意,Android平台开发人员似乎也遇到了这个问题,他们有一个解决方案,可以为不同的选择器状态重新使用相同的后台资源。显然,这会触发一个重新验证调用来修复问题(至少对我来说)