onCreateでgetWindow().setSoftInputModeを呼び出してSoftInputModeの設定をすると
フォーカスが当たっている場合に、ソフトウェアキーボードが表示される。
起動時にフォーカスを当てるために、対象のEditTextにrequestFocusを追記する。
package sample.softwarekeyboard;
import android.app.Activity;
import android.os.Bundle;
import android.view.WindowManager;
public class SoftwareKeyboardActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
<EditText
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<requestFocus />
</EditText>