Problems changing layout when clicking the Android button

Asked 2 years ago, Updated 2 years ago, 22 views

Like the picture above I hope the keyboard disappears when you click the button and the layout changes like in the picture.

Version is api19 and

for the activity in the manifest By writing android:windowSoftInputMode="justResize", the layout can be changed depending on the presence or absence of the keyboard (i.e., button bars can be on the button as shown in the picture above).

And Inside the onClick

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

imm.hideSoftInputFromWindow(writeEt.getWindowToken(), 0);```

I wrote it like this so that the keyboard can hide.


But I don't know how to fill the layout crying

android

2022-09-22 14:18

1 Answers

It would be helpful to look at the code below to show the layout in the keyboard area.

To add a brief description, soft keyboards vary in height from phone to phone, so you need to find the height of the keyboard and set the layout to be the same size as the keyboard.

For the part that actually shows the layout (which uses PopupWindow for that code), look at the code above.


2022-09-22 14:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.