2013-10-21 51 views
2

我正在使用Google地图制作应用程序。我正在使用AutoCompleteTextView获取地点的建议。输出如下:Android AutoCompleteTextView重叠TextView的建议

enter image description here

正如你可以从图片看,意见箱的边界重叠的TextView。我在线性布局中使用带Textview的自定义项目布局。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#fff" 
    android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/resultValue" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="#fff" 
     android:paddingBottom="5dp" 
     android:paddingLeft="5dp" 
     android:paddingRight="5dp" 
     android:paddingTop="5dp" 
     android:textColor="#474040" 
     android:textSize="15sp" /> 

</LinearLayout> 

有没有办法让建议窗口关闭,并删除或更改建议窗口的灰色边框的颜色?

回答

2

尝试这样,机器人:popupBackground = “#EFEEEC” 根据你的边界 //改成你想要的意见箱

<AutoCompleteTextView 
      android:id="@+id/autocomplete" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="10dp" 
      android:background="@drawable/text_area" 
      android:inputType="text|textNoSuggestions|textMultiLine" 
      android:paddingLeft="10dp" 
      android:popupBackground="#EFEEEC" 
      android:textColor="#333333" 
      android:textColorHint="#9c9c9c" 
      android:textSize="18sp" 
      android:completionThreshold="1" /> 

和auto_textview.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="12dp" 
    android:textColor="#333333" 
    android:layout_margin="15dp" 
    android:textSize="16sp" > 
</TextView> 

text_area9.png

enter image description here

最后的输出会像

enter image description here

希望这有助于你。

+0

是的,它的工作!谢谢 ! –

+0

@ adityap174很乐意为您效劳。快乐编码.. –

+0

问题是在eclipse中,popupBackground不会出现在自动填充建议中,所以我错过了它。你能告诉我如何改变边框的大小吗?使用你的方法,我能够改变颜色,并通过此条目: [链接](http://daniel-codes.blogspot.in/2012/11/styling-autocompletetextview.html)我能够改变分隔线样式但