I have a LinearLayout and an associated Activity. In my view there is an EditText's box and a bunch of Buttons. When I start the application, focus goes immediately to the EditTexts box and the soft keyboard comes up. Is there a way to avoid this so that it just comes up with nothing selected and no soft keyboard popping up? I have tried findViewById().clearFocus() and requestFocus() on different views, but nothing seems to work.
Asked
Active
Viewed 1,182 times
1
Yurets
- 3,871
- 17
- 48
- 73
user306517
- 483
- 8
- 21
1 Answers
2
Change your Activity settings in manifest like below:
<activity
android:name=".MyActivity"
android:windowSoftInputMode="stateHidden">
</activity>
pawelzieba
- 16,024
- 3
- 43
- 72
-
cool, that works, but the edit box is still selected. I even try to findViewById(R.id.myedittext).setSelected(false) and it's *still* selected... – user306517 Feb 21 '11 at 17:37
-
heh, I found answer, it's ...funny: http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup – pawelzieba Feb 21 '11 at 17:56