MultiAutoCompleteTextView建议分隔符颜色 [英] MultiAutoCompleteTextView suggestion separator color

查看:108
本文介绍了MultiAutoCompleteTextView建议分隔符颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android应用中使用MultiAutoCompleteTextView.我需要自定义此控件的建议列表.我已尝试来自定义列表分隔符颜色,但这对我不起作用.如何更新MultiAutoCompleteTextView的默认列表分隔符颜色?

I'm using MultiAutoCompleteTextView in my Android app. I need to customize the suggestion list of this control. I've tried this to customize the list separator color but this didn't worked for me. How can I update the default list divider color of MultiAutoCompleteTextView?

推荐答案

除了设置divider颜色,还需要设置dividerHeight属性,否则该属性将不起作用.而且MultiAutoCompleteTextView使用的Popup实际上是ListView,因此此处的设置正确.

In addition to setting the divider color, you need to also set the dividerHeight property or it won't work. And the Popup used by the MultiAutoCompleteTextView is actually a ListView, so setting that is correct here.

将此添加到您的styles.xml文件中:

Add this to your styles.xml file:

<style name="myStyle" parent="@android:style/THeme.Holo.Light"> <!-- or whatever style you inherit -->
    <item name="android:dropDownListViewStyle">@style/DropDownListViewStyle</item>
</style>

<style name="DropDownListViewStyle" parent="android:style/Widget.ListView.DropDown">
    <item name="android:divider">@android:color/holo_orange_dark</item>
    <item name="android:dividerHeight">2px</item>
</style>

这会将MultiAutoCompleteTextViewPopup中的分隔线设置为橙色.

This will set the dividers in the MultiAutoCompleteTextView's Popup to orange.

这篇关于MultiAutoCompleteTextView建议分隔符颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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