AutoCompleteTextView始终保持焦点

nr1*_*nr1 6 user-interface android focus

我有2 AutoCompleteTextViews一个活动(LinearLayout)和几个additional controls(无线电组,按钮等).不知何故,AutoCompleteTextViews是never losing focus.

例如:用户单击AutoCompleteTextView,控件获得焦点.因此光标开始闪烁,显示自动完成下拉列表和键盘.这可以.但是,如果user now clicks on of the radio buttons(或另一个控件),is still blinking仍然显示AutoCompleteTextView 和键盘中的光标.

如何使焦点自动消失?

编辑: xml代码

                <AutoCompleteTextView
                android:id="@+id/ediFrom"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:singleLine="true"
                android:text="" />
Run Code Online (Sandbox Code Playgroud)

Mic*_*neš 8

只有对我有用的解决方案是添加此行

android:focusable="true" 
android:focusableInTouchMode="true"
Run Code Online (Sandbox Code Playgroud)

到AutoCompleteTextView的父级(如LinearLayout等..)


Kau*_*hik 2

你尝试过android:focusableInTouchMode="true"代码each view 片段吗

<AutoCompleteTextView
      android:id="@+id/ediFrom"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:singleLine="true"
      android:focusableInTouchMode="true"
      android:text="" />
Run Code Online (Sandbox Code Playgroud)

http://android-developers.blogspot.in/2008/12/touch-mode.html