Android Question Keyboard interfering with Customlistview

zetadan

Member
Licensed User
Longtime User
Hello fellow programmers,

My new app uses a customlistview for displaying multiple edittexts in list form. The problem is that the keyboard covers up the items at the very bottom of the list. The user can only scroll so far. Once the keyboard is up, it is impossible to access the last couple of boxes without hiding the keyboard and then clicking on the boxes that were hidden and repeating this process.

Does anyone know of a simple fix for this?

Any help or direction would be greatly appreciated.

Dan
 

zetadan

Member
Licensed User
Longtime User
Actually this does not fix the problem. When I went to add the line to the manifest I discovered I already had it in there. There are two problems that can be caused in this type of example with customlistview, edittexts and the keyboard.

1. The keyboard covers up the edittext when near the bottom of the screen.
The link (manifest adjustpan addition) provided by Erel solves this problem

2. The screen is pushed up when the keyboard is launched and the edittext is visible. However, the user cannot scroll to the bottom of the list (and the lower edittexts) as the keyboard still covers those items. Once the keyboard is off the items are again visible underneath the area that the keyboard covered.
This is the current problem I am having and is not solved by the link above detailing adjustpan addition.

Any more suggestions anyone?

Dan
 
Last edited:
Upvote 0

zetadan

Member
Licensed User
Longtime User
Thanks for the help Erel.

Attached is a short program that shows what I am talking about. Click on the edittext to the right of the "eleven" element. With the keyboard displayed try to scroll to the bottom of the customlistview.

Dan
 

Attachments

  • Customlistviewtest.zip
    401.7 KB · Views: 214
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Hi Dan .. as a worst case scenario , one option is to simply add half a dozen empty panels at the bottom of the SV.
Not elegant but it works .. the Panels have been disabled to stop user interaction.
see attach project. Hopefully a better solution will be offered..
 

Attachments

  • CustomListViewTest2.zip
    13.9 KB · Views: 189
Last edited:
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Try this solution, tested on my Nexus 7 and it works perfectly. I expected that I would need to move the CustomListView to the correct scroll position but luckily it takes care of itself on the resize :)

B4X:
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
    Dim intKeyboardSize As Int = Max(NewHeight, OldHeight) - Min(NewHeight, OldHeight)
    If NewHeight < OldHeight Then    ' Keyboard displayed
        customlist1.AsView.Height = customlist1.AsView.Height - intKeyboardSize
    Else                             ' Keyboard hidden
        customlist1.AsView.Height = customlist1.AsView.Height + intKeyboardSize   
    End If
End Sub
 

Attachments

  • clvKeyboardExample.zip
    8.8 KB · Views: 214
Upvote 0

zetadan

Member
Licensed User
Longtime User
Thanks MangoJack: That's still an option if all else fails.

RandomCoder: Thanks, your code works very well on my example.

However, when I included it in my main program, the heightchanged event is never raised, so the code never gets executed.

I can't figure out why there is a difference between the sample program and the actual program.

So frustrating.
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Have you initialised it using the same event name which I think is also case sensitive?
 
Upvote 0
Top