android auto scroll when clicked on edittext

前端 未结 4 1944
忘了有多久
忘了有多久 2020-12-10 09:42

When user click on edittext I want the screen to scroll to show the edittext in the middle of the screen. So I tried to listen to touch (setOnTouchListener, also tried with

4条回答
  •  独厮守ぢ
    2020-12-10 10:37

    Use this line of code on your onCreate method . It gives you auto scrolling when you clicked on EditText :

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    

提交回复
热议问题