0

So I have a main activity with 3 TextFields that are offset from the top because I am using tabbed navigation :

But what happens on small screens is that the keyboard hides the third textfield "Receiver".

How can I solve this ? Would using a ScrollableLayout be a solution (so the user could scroll to unhide the third textfield) ?

4 Answers 4

2

You can achieve this using Accompanist Insets library (UPD: link into the past) in three steps :-

1- in your activity call setDecorFitsSystemWindows

WindowCompat.setDecorFitsSystemWindows(window, false) 

2- call the ProvideWindowInsets function and wrap your content

ProvideWindowInsets { // your content } 

3- call navigationBarsWithImePadding modifier in your content

Full Example :-

WindowCompat.setDecorFitsSystemWindows(window, false) // step 1 setContent { MaterialTheme { ProvideWindowInsets { // step 2 Column( modifier = Modifier .navigationBarsWithImePadding() // step 3 ) { // your content } } } } 
Sign up to request clarification or add additional context in comments.

Comments

0
<application ... > <activity android:windowSoftInputMode="adjustResize|adjustPan" ... > ... </activity> ... </application> 

Add this to your manifest

https://developer.android.com/training/keyboard-input/visibility[Documentation][1]

android:windowsSoftInputMode defines the positioning of the elements.

1 Comment

Well adding this does not change anything
0

Paste this in the onCreate before setContent

window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)

Credits:- https://stackoverflow.com/a/64053897/15880865

.

1 Comment

Does not work (at least on API 30) most apparently because it was depreciated in API 26
0

So I managed do this using the accompanist library and setting the modifier to Modifier.navigationBarsWithImePadding()

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.