How to resize AlertDialog on the Keyboard display

前端 未结 6 1925
时光取名叫无心
时光取名叫无心 2020-12-05 00:39

I have a AlertDialog box with approximately 10 controls (text and TextView) on it. These controls are in a ScrollView with Alert

6条回答
  •  情歌与酒
    2020-12-05 00:52

    to show keyboard immediately and adjust size:

    editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            }
        }
    });
    

提交回复
热议问题