Android自动完成和软键盘
我完全按照计划行事。当涉及软键盘时,布局会出错 在下拉列表中点击(选择或滚动)后,布局被破坏: 我在AutoCompleteTextView上尝试了各种属性组合,但似乎都不起作用。我还尝试设置WindowsOfInputMode。下拉列表总是在文本框上方弹出,并且永远停留在那里 在横向中,布局正常: 标准的自动完成是无用的吗?我应该用另一个/写我自己的吗 我使用的代码如下:Android自动完成和软键盘,android,android-widget,Android,Android Widget,我完全按照计划行事。当涉及软键盘时,布局会出错 在下拉列表中点击(选择或滚动)后,布局被破坏: 我在AutoCompleteTextView上尝试了各种属性组合,但似乎都不起作用。我还尝试设置WindowsOfInputMode。下拉列表总是在文本框上方弹出,并且永远停留在那里 在横向中,布局正常: 标准的自动完成是无用的吗?我应该用另一个/写我自己的吗 我使用的代码如下: <?xml version="1.0" encoding="utf-8"?> <LinearLay
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Country" />
<AutoCompleteTextView android:id="@+id/autocomplete_country"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
</LinearLayout>
MainActivity.java:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES);
textView.setAdapter(adapter);
}
@覆盖
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AutoCompleteTextView textView=(AutoCompleteTextView)findViewById(R.id.autocomplete\u国家/地区);
ArrayAdapter=新的ArrayAdapter(此,R.layout.list_项,国家/地区);
setAdapter(适配器);
}
我没有使用AutoCompleteTextView,而是使用了EditText和ListView,如图所示。您遵循了哪些教程?请向我们展示一些代码。所有代码都在链接教程中。我不想复制它,但我在这里复制了它。你在什么设备上运行它?HTC Desire,但它在模拟器中的行为也一样。