Sub TabLayout_TabSelected(Index As Int, SelectedTab As String, Tag As Object)
If Index =0 Then
VP_PageChanged (0)
End If
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout1")
PC.Initialize
For i = 0 To 2
Dim p As Panel
p.Initialize("")
PC.AddPage(p, "")
Next
VP.PageContainer = PC
Dim ac As AppCompat
TabLayout.Color = ac.GetThemeAttribute("colorPrimary")
TabLayout.SetViewPager(VP)
Dim xml As XmlLayoutBuilder
TabLayout.SetTabIcon(0, xml.GetDrawable("ic_alarm_white_24dp"))
TabLayout.SetTabIcon(1, xml.GetDrawable("ic_favorite_white_24dp"))
TabLayout.SetTabIcon(2, xml.GetDrawable("ic_settings_white_24dp"))
End Sub
Sub VP_PageChanged (Position As Int)
Dim AltoBoton As Int
AltoBoton=(VP.Height /3)
If FLAGS(Position)=False Then
panActive = PC.GetPageObject(Position)
panActive.LoadLayout("custlv")
If Position=0 Then
For i= 1 To 1
CustomListView1.Add(CreaItem( (i), CustomListView1.AsView.Width ,AltoBoton ), AltoBoton+0dip, i)
Next
FLAGS(0)=True
Else If Position=1 Then
For i= 2 To 3
CustomListView1.Add(CreaItem( (i), CustomListView1.AsView.Width ,AltoBoton ), AltoBoton+0dip , i)
Next
FLAGS(1)=True
Else
For i= 4 To 6
CustomListView1.Add(CreaItem((i), CustomListView1.AsView.Width ,AltoBoton ), AltoBoton+0dip, i)
Next
FLAGS(2)=True
End If
Else
panActive = PC.GetPageObject(Position)
End If
End Sub
Sub CreaItem(strStarCount As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
Activity.AddView(p, 0, 0, Width, Height)
p.LoadLayout("CellBoton")
p.RemoveView
texto1.Text="tEXTO " & strStarCount
Boton1.Text="bOTON " & strStarCount
Return p
End Sub
Sub Boton1_Click
panCustListCell_Click
End Sub
Sub panCustListCell_Click
Try
Dim index As Int = CustomListView1.GetItemFromView(Sender)
Msgbox("ESTE ES EL BOTON " & CustomListView1.GetValue(index) ,"")
Catch
Msgbox(LastException,"")
End Try
End Sub