make autocompletetextview look like edittext

2019-08-12 03:17发布

问题:

I am using an AutoCompleteTextView (RobotoAutoCompleteTextView) instead of an EditText. But I want the look and feel of an EditText: i.e. the underline that shows up at the bottom of an EditText. So how might I do that?

My question is a bit incomplete so let me clarify. In the Eclipse Graphical Layout the AutoCompleteTextView looks exactly like the EditText with the underline. But when I run the app in my Samsung Galaxy S5, the underline is gone. Instead I get an ugly box with some "#22000000" background. (Of course I am guessing at the exact hex of the background). So what I need is for the underline to always shows up no matter what device I am using: real phone, or just the Graphical Layout.

回答1:

Try this:

<AutoCompleteTextView
 ...
 style="@style/Base.Widget.AppCompat.EditText" />

or this

<EditText
 ...
 style="@style/Base.Widget.AppCompat.AutoCompleteTextView"/>