How to add margin between EditText and Soft Keyboard?

前端 未结 6 1717
刺人心
刺人心 2020-12-16 09:58

I want to add 10dp margin between EditText and Soft Keyboard.

\"enter Here is my XML:<

6条回答
  •  自闭症患者
    2020-12-16 10:13

    Try to add your RelativeLayout in ScrollView, and then add code below:

    editTextField.setOnFocusChangeListener(new OnFocusChangeListener() {
    
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            // TODO Auto-generated method stub
            if (hasFocus)
                 scrollView.scrollBy(0, 150);
    
        });
    

提交回复
热议问题