Can anyone tell me how to show the soft input keyboard while a activity opens. In Normal case a keyboard pops up when we tap inside the edit text but i want to open it automatically when that screen loads.
here is the xml layout file
and here is the main.xml layout file
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="This is my sample App of android"
android:textColor="#000000" android:textSize="20dip">
</TextView>
<EditText android:id="@+id/EditText01" android:layout_height="wrap_content"
android:layout_width="fill_parent"></EditText>
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Say Hello"></Button>
Check android:windowSoftInputMode
attribute for activity
element of AndroidManifest.xml. In your case it could be:
<activity android:windowSoftInputMode="stateAlwaysVisible" ... />
<activity android:windowSoftInputMode="stateAlwaysVisible" ... />
as Ralkie's answer. But to test on emulator you have to be careful in how your AVD is configured: the default configuration has keyboard support... You need to add the hardware property "Keyboard support" with "no" value on your AVD in order to test it on emulator.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.