Android Question Form with many inputs

ThePuiu

Active Member
Licensed User
Longtime User
I have a CustomListView in which I load a panel that contains a larger number of inputs (B4XComboBox, B4XFloatTextField and an Button for submit).
The height of the panel exceeds the height of the screen, scrolling is required. What is the correct approach in this case for the inputs that are at the bottom of the panel because the keyboard overlaps them when editing? I tried to make the panel longer with the height of the keyboard but I don't think it's a very good / optimal idea.
Thank you!
 

ThePuiu

Active Member
Licensed User
Longtime User
I have added the following line in the manifest file:
B4X:
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)

then I added the following subroutine:
B4X:
Sub Globals
    Private clvAdaugaLucrare As CustomListView
    Dim keyboard As IME
    Dim px As B4XView
End Sub

Sub keyboard_HeightChanged(NewHeight As Int, OldHeight As Int)
    px = clvAdaugaLucrare.GetPanel(0)
If NewHeight > OldHeight Then
    px.SetLayoutAnimated(0,0,0,Activity.Width, 480dip + NewHeight)
End If
End Sub

but opening the keyboard (focus in an edittext) does not reach the keyboard_HeightChanged
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
You might not need the manifest entry, but you do need these lines in you Activity _Create so it will generate the event:
B4X:
IME.Initialize("IME")
IME.AddHeightChangedEvent
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
I am pretty sure he does Johnny
I have many apps that properly resize views in response to the keyboard_resize event and I do not have any manifest entries for those activities.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Also you need to match the event name to the IME. Initialize ("IME" as in my example instead of "keyboard"):

B4X:
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
 
Upvote 0
Top