啊塔

导航

点击空白区域隐藏软键盘

 

flipperview=(LinearLayout) findViewById(R.id.flipperview01);
        flipperview.setOnTouchListener(touchListener);

 

OnTouchListener touchListener=new OnTouchListener() {
    
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
        Log.i("scrollview", "scrollview+++++++++++");
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            if (getCurrentFocus() != null && getCurrentFocus().getWindowToken() != null) {
                getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                View inputText = getCurrentFocus();
                imm.hideSoftInputFromWindow(inputText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            }
        }
        return false;
    }
};

 

posted on 2013-07-17 10:20  啊塔  阅读(319)  评论(0编辑  收藏  举报