Android Soft Keyboard Dwarfs EditTexts in ScrollView

I have a TableLayout that populates_parent inside a ScrollView. Everything works fine, except when Soft Keyboard is displayed, it obscures the last few EditTexts. Technically, the screen can no longer scroll, since without displaying the keyboard, the screen is suitable for all content. Just when the keyboard is showing, I cannot scroll to the bottom to see the remaining EditTexts without hiding the keyboard and letting the user simply select and enter values ​​in one of the lower EditTexts. Using this , I tried:

Window.SetSoftInputMode((int)SoftInput.AdjustPan); 

and

 Window.SetSoftInputMode((int)SoftInput.AdjustResize); 

and

 [Activity(WindowSoftInputMode = SoftInput.AdjustPan)] 

and

 [Activity(WindowSoftInputMode = SoftInput.AdjustResize)] 

and

 Window.SetFlags(WindowManagerFlags.AltFocusableIm, WindowManagerFlags.AltFocusableIm); 

It just prevented the keyboard from rising at all. This is not what I need. I need my content to be configured to appear above the keyboard when it is visible, so I can continue to scroll to the bottom EditText with the keyboard shown. Excerpt from a very long xml. The table is dynamically populated with code.

 <ScrollView android:id="@+id/peScroll" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/security"> <TableLayout android:id="@+id/poweredEquip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:stretchColumns="*" android:gravity="center" android:padding="10dip"> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/tab_bg_unselected" android:gravity="center"> <TextView android:text="Serial" android:textSize="15sp" android:textColor="@android:color/black" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="middle" android:gravity="center" android:layout_column="1"/> </TableRow> </TableLayout> </ScrollView> 
+2
source share
1 answer

This is probably not the most elegant solution, but he decided to just add a large marginBottom to the last line.

+1
source

Source: https://habr.com/ru/post/919340/


All Articles