我有一個edittext和一個微調。當我觸摸編輯文本時,出現鍵盤,完成文本編輯後,我觸摸微調器的下拉箭頭,但鍵盤不會自動消失。請給我一些解決方案。 我想這個代碼如何隱藏虛擬鍵盤觸摸旋鈕
InputMethodManager imm=(InputMethodManager)getApplicationContext().getSystemService(SetUpProfileActivity.this.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mDateOfBirth.getWindowToken(), 0);
這是XML
<LinearLayout
android:id="@+id/outerlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
>
<TextView
android:id="@+id/name_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/profile_name"
android:textColor="#ffffff" />
<EditText
android:id="@+id/profile_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/txtbox"
android:singleLine="true" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/dateofbirth"
android:textColor="#ffffff" />
<Spinner
android:id="@+id/dob"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/dropdown" />
Softkeyboard自動消失的是當你的EditText失去焦點..所以可能是你使用任何其他財產的EditText,顯示你的XML代碼: –
@CapDroid我已經發布我的XML,請讓我知道我我錯了。 – swati