Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - show keyboard fix bottom framelayout

I am developing an android application in which my mainActivity has 5 tabs at the bottom represented in FrameLayout. Each tab points to a particular fragment which gets loaded based on the tab clicked.

In my 1st tab, I've an EditText. When the edit text is focused, I need to show the keyboard by just moving the layout of ('EditText and Send button) "up" without pushing up the other components including the bottom tab frame layout. Similarly when hiding the keyboard, the 'EditText and Send btn' layout should sit just above the tab frame layout. Can someone please suggest me the solution for this?

(Assume the situation same as in Facebook comment. When we go inside a post to comment something, the layout ('Write Comment' ET and POST btn) will be pushed up without moving any other components including the bottom tabs ('News Feed', 'Requests', 'Messenger', 'Notifications', 'More'))

I don't want to make the frame layout Visibility.Gone/Visible as it ends up in an ugly animation when the keyboard slides up/down.

like image 323
maanick90 Avatar asked Dec 28 '25 02:12

maanick90


1 Answers

Use a LinearLayout whit no weightSum, and give your main View in your layout 0dp height, and weight 1

like image 113
feridok Avatar answered Dec 30 '25 15:12

feridok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!