Android Question xcustomlistview item position and keyboard

Addo

Well-Known Member
Licensed User
Longtime User
i have created the following project with xcustomlistview object
B4X:
Private CustomListView1 As CustomListView' i use it as a chatbox

i got a few problems to scroll to the end in CustomListView1 when the keyboard is showing the scrolling to end does not show the last inserted item


thats how i set the ime to adjust the view

B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")
    copymenu.AddTextItem("Copy", "Copy")
    copymenu.AsView.Visible = False

    IME.Initialize("IME")
    IME.AddHeightChangedEvent
    IME_HeightChanged(100%y, 0)
    IME.AddHandleActionEvent(EditText1)
 

End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
    Panel1.Top = NewHeight - Panel1.Height
    Panel2.Height = Panel1.Top - Panel2.Top
    CustomListView1.AsView.Height = Panel2.Height
End Sub

and thats how i send and give order to scroll to the latest item

B4X:
Sub Button1_Click

   
CustomListView1.Add(CreateListItem(EditText1.Text, CustomListView1.AsView.Width, 50dip), EditText1.Text)
EditText1.Text = ""
Sleep(0)
CustomListView1.ScrollToItem(CustomListView1.Getsize - 1)
   
End Sub


what could be my mistake ?
 

Attachments

  • testclvs.zip
    17.3 KB · Views: 267
Last edited:
Top