游戏人生

不积跬步,无以至千里;不积小流,无以成江海。

导航

[工作积累] Software keyboard not shown on Activity.onCreate

    protected void onCreate (Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.input);
        mInput = (EditText)findViewById(R.id.text_input);
        ...
        mInput.requestFocus();
        mInput.postDelayed(new Runnable() {
            @Override
            public void run() {
                // TODO Auto-generated method stub
                InputMethodManager keyboard =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                keyboard.showSoftInput(mInput, 0);
            }
        },200);
    }

 

The keyboard is hidden immediately, so showing the keyboard with some delay will solve the problem.

posted on 2015-01-21 14:34  crazii  阅读(164)  评论(0编辑  收藏  举报