简体   繁体   中英

Android move view on top of the keyboard

I want to move an edit text on top of the keyboard when the keyboard opens. And when the keyboard closes I want to move the view back to its original position. Something like this video .

Here in the video when you tap on the edit text field the keyboard opens and the view translates on top of the keyboard, now when the keyboard closes the edit text comes back to the original position. Also, notice how any view on the background is not moving its place only edit text is moving.

I have done this partially by android:windowSoftInputMode in the activity. but doing so will move the entire activity not that only particular edit text.

So can anyone please guide me with this?

In your Manifest file inside the selected activist tag add

android:windowSoftInputMode="adjustResize"

and in your EditText add

android:layout_alignParentBottom="true"

Hope this might help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM