AutoCompleteTextView dropDownSelector [英] AutoCompleteTextView dropDownSelector

查看:265
本文介绍了AutoCompleteTextView dropDownSelector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个AutoCompleteTextView组成部分,我想改变它的默认选择下拉到另一种颜色。首先我想:的android:dropDownSelector =#FF400000,但没有造成人员选择在所有出现!接下来,我把颜色可绘制资源:

I have an AutoCompleteTextView component and I want to change its default drop down selector to another color. First I tried: android:dropDownSelector="#FF400000", but it caused no selector to appear at all! Next I put the color in a drawable resource:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@android:color/holo_blue_dark"/>
</shape>

并将其链接:的android:dropDownSelector =@绘制/ drop_down_selector,但也做了同样的效果(不选择)。接下来,我发现了一个类似的问题有人开,只是微调: HTTP ://$c$c.google.com/p/android/issues/detail ID = 24922 ,所以我试图定义一个风格在溶液中解释道:

And linked it: android:dropDownSelector="@drawable/drop_down_selector", but that did the same effect (no selector). Next I found a similar issue someone opened, just for spinner: http://code.google.com/p/android/issues/detail?id=24922, so I tried defining a style as was explained in the solution there:

<style name="AutoCompleteDropDown" parent="@android:style/Theme.Holo.Light">
    <item name="android:dropDownListViewStyle">@style/AutoCompleteSelector</item>
</style>
<style name="AutoCompleteSelector" parent="@android:style/Widget.Holo.Light.ListView">
    <item name="android:listSelector">#FF400000</item>
</style>

并将其链接:风格=@风格/ AutoCompleteDropDown,但什么也没做(但是,默认选择回来,因为我删除了 dropDownSelector 属性)。

And linked it: style="@style/AutoCompleteDropDown", but it did nothing (however, the default selector got back since I removed the dropDownSelector attribute).

那么,我在这里丢失?我在做什么错了?

So what am I missing here? What am I doing wrong?

更新:确定,这样有人建议,我也尝试了选择:

UPDATE: Ok, so as was suggested, I also tried a selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_selected="true" android:state_pressed="true" 
       android:state_focused="true" android:state_activated="true"
       android:drawable="@android:color/holo_green_light"/>
</selector>

但它没有工作,我仍然拿不出选择(至少不是一个我可以看到)。

But it didn't work, I still get no selector (at least not one I can see).

推荐答案

尝试从您的看法,它通过适配器生成去除背景。这帮助了我。

Try remove background from your views, which generated by adapter. That has helped me.

这篇关于AutoCompleteTextView dropDownSelector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆