Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SnackBar is not showing properly if the keyboard is opened in android

I am using snack bar for displaying information, it is working fine if keyboard is not opened. If keyboard is opened the snack bar message displaying whole screen not displaying properly i am using android 5.5. I added this line android:windowSoftInputMode="adjustResize|stateAlwaysHidden" in my activity manifest but still same issue. Please help me for this issue. Please find the image belowscreen shot. My snack bar code is Snackbar.make(coordinator,getString(R.string.validation_plz_enter_mandatory_flds, UtilConstants.ERROR_CODE_UI_2000),Snackbar.LENGTH_INDEFINITE).show();

like image 427
Ganesh P Avatar asked Oct 23 '25 17:10

Ganesh P


2 Answers

This is the Correct Solution of this problem: SnackBar show Above the SoftInput (Keyboard) - (when Keyboard is Open)

<activity android:name=".YourActivity"
    android:windowSoftInputMode="adjustResize"/> 

tag into your activity tag of the manifest.

enter image description here

like image 185
Prince Dholakiya Avatar answered Oct 26 '25 07:10

Prince Dholakiya


Have you initialized your snackbar like below code:

snackbar = Snackbar.make(findViewById(android.R.id.content), <Your message>, Snackbar.LENGTH_LONG);

or you have used your own layout??

Because if we use android's own UI element(android.R.id.content) it manages to show on valid UI of their own. You should first try this.

like image 25
Android Geek Avatar answered Oct 26 '25 08:10

Android Geek



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!