I have an activity with an editText in the middle. When I click on the editText the keyboard appears, and the screen moves so that the editText is just above the keyboard, covering the other stuff that is below.
I don't want to resize or add padding to the layout. I need that the screen scrolls to the top the amount of space that I need to see also the other stuff below. In other words, I'd like to select the position of the editText when the keyboard appears. It would be enough also if the screen scrolls up completely, showing me the bottom of the layout.
I tried to put the layout in a scrollView adding this code on the editText
editText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//make the view scroll down to the bottom
scrollView.scrollTo(0, scrollView.getBottom());
}
});
but it doesn't work. Does anyone have an idea? Thank you in advance!