Mam Fragment
(wersję kompatybilności) z EditText
w swoim układzie. Używam ViewFlipper
do przechodzenia między fragmentami. Kiedy dotrę do tego konkretnego Fragment
, miękka klawiatura otwiera się automatycznie. Nie tego chcę. Oto, co próbowałem zatrzymać lub ukryć.EditText automatycznie otwiera miękką klawiaturę, gdy Fragment jest widoczny z ViewPager
Próbowano:
android:descendantFocusability="beforeDescendants"
w głównym widoku fragment jest
Próbowaliśmy:
android:windowSoftInputMode="stateHidden"
i
android:windowSoftInputMode="stateAlwaysHidden"
w manifeście aktywności
Tried:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mViewPager.getChildAt(position).getWindowToken(), 0);
na OnPageChangeListener mojego ViewPager
Tried:
InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(voucherView.findViewById(R.id.redeem_mobile_number).getWindowToken(), 0);
w onCreateView w moim Fragment
próbowałem:
InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getView().findViewById(R.id.redeem_mobile_number).getWindowToken(), 0);
w onStart w moim Fragment
Tried:
voucherView.findViewById(R.id.redeem_mobile_number).clearFocus();
w onCreateView w moim Fragment
Wydaje mi się onPageChangeListener jest miejsce, aby to zrobić, ponieważ pozostałe połączenia nastąpi przed miękka klawiatura jest rzeczywiście otwarta. Każda pomoc byłaby świetna.
Aby ukryć klawiaturę w try fragmentu. InputMethodManager imm = (InputMethodManager) getSherlockActivity() getSystemService (Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow (inputSearch.getWindowToken(), 0); P.S inputSearch to pole EditText –