For i = 0 To 100 Dim p As AnchorPane p.Initialize("") p.LoadLayout("ListItem") ImageView1.SetImage(backbmp) listview1.Items.Add(p) Next
Hello erel, we say that a nose I managed to make a listview with bitmaps, now I make sure that references to the touch line starts a call to the number that is written on this list, hog s early activated the library on phone and declared globals : dim p as phnecalls, how can I do to make sure that the call is made? I have seen several guides but none that explains, in addition to this I have another doubt when you turn the smartphone, how can I do so that the app is effectively the same? thanks for everything!B4J ListView can hold simple items like strings or numbers and also customized items.
The core ListView is similar to both B4A ListView and CustomListView class.
Adding custom items is done by adding Nodes to the ListView items collections.
Instead of showing the item "value" the Node itself will be displayed.
The Node can be an AnchorPane that holds other nodes or it can be any other node type as well.
For example to create a list that shows the available fonts:
Sub Process_Globals Private fx As JFX Private MainForm As Form Private lv As ListView End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.Show lv.Initialize("lv") MainForm.RootPane.AddNode(lv, 0, 0, 0, 0) MainForm.RootPane.SetAnchors(lv, 0, 0, 0,0) For Each family As String In fx.GetAllFontFamilies Dim lbl As Label lbl.Initialize("") lbl.Text = family lbl.Font = fx.CreateFont(family, 22, False, False) lv.Items.Add(lbl) Next End Sub Sub lv_SelectedIndexChanged(Index As Int) If Index > -1 Then Dim lbl As Label = lv.SelectedItem Log(lbl.Text) End If End Sub
A more complicated example is attached. It uses ImageDownloader to download a list of images (similar to this B4A example: http://www.basic4ppc.com/android/fo...ple-way-to-download-images.30875/#post-179512 )
Note that the images show when they are ready.
This feature depends on v1.00 (beta 5+).
#Region Project Attributes #MainFormWidth: 600 #MainFormHeight: 400 #End Region Sub Process_Globals Private fx As JFX Private MainForm As Form Private lv As ListView Dim lbl1 As Label Dim chk1 As CheckBox Dim p As AnchorPane Private Toast As ToastMessageShow End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.Show MainForm.RootPane.LoadLayout("Main") Toast.Initialize("Toast") End Sub Sub fillList For i=0 To 10 p.Initialize("") p.LoadLayout("listItemP") lv.Items.Add(p) lbl1.Text = "Test"&" "&i chk1.Checked=False Next End Sub Sub btnSend_MouseClicked (EventData As MouseEvent) lv.Items.Clear fillList End Sub Sub lv_SelectedIndexChanged(Index As Int) If Index > -1 Then Dim lbl As Label = lv.SelectedItem 'Toast.ToastShow(lbl.text) Log(lbl.Text) End If End Sub