Android Question Keyboard interfering with Customlistview

Discussion in 'Android Questions' started by zetadan, Apr 4, 2015.

  1. zetadan

    zetadan Member Licensed 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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. zetadan

    zetadan Member Licensed User

    Thanks Erel,

    I couldn't seem to find this on my own. Trying now.

    Dan
     
  4. zetadan

    zetadan Member Licensed 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: Apr 5, 2015
  5. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload a small project that demonstrates this issue?
     
  6. zetadan

    zetadan Member Licensed 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
     

    Attached Files:

  7. mangojack

    mangojack Well-Known Member Licensed 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..
     

    Attached Files:

    Last edited: Apr 12, 2015
  8. RandomCoder

    RandomCoder Well-Known Member Licensed 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 :)

    Code:
    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
     

    Attached Files:

    Peter Simpson likes this.
  9. zetadan

    zetadan Member Licensed 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.
     
  10. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Have you initialised it using the same event name which I think is also case sensitive?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice