Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android scroll down

I have text area and and down to that "ok" and "cancel" button. when i click on text area keyboard appear and focus on the text area and buttons get hide behind the keyboard.

i want when text area get focus scroll a little bit and also display the bottom buttons while text area id selected.

like image 762
d-man Avatar asked Dec 12 '22 22:12

d-man


1 Answers

i fixed it by myself :D following is the code

i called the following method when textfield gain the focus

private final void focusOnButtons(){
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                ScrollView sv = (ScrollView)findViewById(R.id.scrl);
                sv.scrollTo(0, sv.getBottom());
            }
        },1000);
    }
like image 151
d-man Avatar answered Jan 08 '23 08:01

d-man