开发者

Closing keyboeard, submit button

I need to close the keyboard when a user presses a submit button so the data behind the keyboard can be seen. Here is how I have the button wired, but its not working.

Any ideas?

        Button clearbutton = (Button)findViewById(R.id.Submitbutton);
        Submitbutton.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub

                {

                    //...etc...
                    getWindow().setSoftInputMode(WindowManager.开发者_如何学GoLayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);


                }


Something like this should work (also, see this post).

Button clearbutton = (Button)findViewById(R.id.Submitbutton);
Submitbutton.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v){
        ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(EditTextAirportCode.getWindowToken(), 0);

    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜