Android Question customlistview jumptoitem & IME HeightChanged keyboard event issue

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

  1. leitor79

    leitor79 Active Member Licensed User

    Hi,

    I have a customlistview on my activity (among others), and I'm handling the keyboard opening and closing events to manage the views sizes to fit the new screen size. That works ok.

    However, I want to use the jumptoitem method to show the last item of the customlistview when I open or close the keyboard. So, I've added this line at the end of the event:

    Code:
    lstChat.JumpToItem(lstChat.GetSize)
    This works OK when I close the keyboard, but when I open it, the customlistview "moves" to show items below, but it not show the last one.

    Code:
    Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
    pnlTop.Left=
    0
    pnlTop.Top=
    0
    pnlTop.Width=
    100%x
    pnlTop.Height=
    50dip

    pnlBottom.Left=
    0
    pnlBottom.Width=
    100%x
    pnlBottom.Height=
    50dip
    pnlBottom.Top=NewHeight - pnlBottom.Height

    Dim v As View
    v=lstChat.asview
    v.Top=pnlTop.Height
    v.Left=
    0
    v.Width=
    100%x
    v.Height=NewHeight-pnlTop.Height -pnlBottom.Height

    lstChat.JumpToItem(lstChat.GetSize)

    End Sub

    Thanks!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. leitor79

    leitor79 Active Member Licensed User

    Thanks Erel, the CallSubDelayed option worked it out. The first one gived me an error; I suppose I didn't used it right (I'm not familiar with the javaobects component):

    Code:
    Dim jo As JavaObject = lstchat
    jo.RunMethod(
    "requestLayout"Null)
    Since the CallSubDelayed method works, I don't need this, but I'm posting it for future reference...
     
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