风格上AutoCompleteTextView下拉 [英] Style on AutoCompleteTextView dropdown

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

问题描述

我一直想立即设置我的下拉的自动完成一段时间的风格。目前,它看起来像这样:

绿化面积与替代品的下拉列表。我想使该盒更小,因为它一点儿也不在我的圆角矩形的那一刻看起来非常好。

我如何实现这一目标?到目前为止,我只能够调整各行吧..


解决方案

把问题在这里发现后出自己5分钟。我会继续的问题为别人谁可能会遇到这种无聊的东西。

您可以简单地把下拉菜单的属性,当您创建autocompletetextview。

 的android:dropDownWidth =yourWidth

Coudln't找到设置下拉backgroundresource不过的程序化途径的任何XML属性正常工作:

<$p$p><$c$c>autoTextView.setDropDownBackgroundDrawable(this.getResources().getDrawable(R.drawable.rounded_rectangle));

这样,您就可以定义下拉应该如何看待与自己的绘制。如果您想从资源XML来改变它,这是一个方法:

 的android:completionHintView =@布局/ your_layout

I've been trying to set the style of my dropdown for the autocomplete for some time now. At the moment it looks like this:

The green area is the dropdown with alternatives. I would like to make that box smaller, since it does'nt look very good at the moment with my rounded rectangle.

How do i achieve this? So far I have only been able to adjust each line in it..

解决方案

Found out myself 5 minutes after putting the question here. I'll keep the question up for someone who might come across this silly stuff.

You can simply put dropdown attributes when you create the autocompletetextview.

android:dropDownWidth="yourWidth"

Coudln't find any xml attribute for setting dropdown backgroundresource but the programmatical way works fine:

autoTextView.setDropDownBackgroundDrawable(this.getResources().getDrawable(R.drawable.rounded_rectangle));

This way you can define how the dropdown should look with your own drawable. If you would want to change it with xml from resource, this is an approach:

android:completionHintView="@layout/your_layout"

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

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