adjustResize and keyboard and scrollview resize

aggelos

Member
Licensed User
Longtime User
as the title says i am trying to resize my scrollview when the keyboard opens

I have a scrollview(height is 1300dip) added to an activity and i have set
this in the manifest file
android:windowSoftInputMode="stateHidden|adjustResize"

this line is supposed to resize my view when the user clicks on an edittext
i found that this line alone doesn't work.so i added this too
SetActivityAttribute(workadd, android:windowSoftInputMode, "stateHidden|adjustResize")

now there is no adjustpan but the scrollview is still not resized when the keyboard opens

i've read that i must set this in the scrollview in order for adjustresize to work
public void setScrollContainer (boolean isScrollContainer)

"Change whether this view is one of the set of scrollable containers in its window. This will be used to determine whether the window can resize or must pan when a soft input area is open -- scrollable containers allow the window to use resize mode since the container will appropriately shrink."


so based on some examples in the forum i tried to do it with reflection
B4X:
Dim r As Reflector
r.Target = scvPanel1
r.RunMethod2("setScrollContainer", True, "java.lang.boolean")

i also tried scvpanel1.panel

i think this is the best approach for handling keyboard and preventing it from appearing over some edittext

this guy in this link did exactly the same thing but not with b4a
Android: fixing window resizing and scrolling


Can anyone help?
 
Top