点击空白区域隐藏软键盘

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;
    }
};
原文地址:https://www.cnblogs.com/jita/p/3195206.html