Android Question TabStripViewPager and picto

ciginfo

Well-Known Member
Licensed User
Longtime User
Hi,
With TabStripViewPager, is it possible to add pictogrammes ? How ?
Thank you
 

Mahares

Expert
Licensed User
Longtime User
With TabStripViewPager, is it possible to add pictogrammes ? How ?
Do you mean the tab labels with icons. If that is what you mean, then here is a link. Follow the 2 easy steps in it. Otherwise, you should explain in English not French what you like to do:
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
Thank you, Yes it is, I know but I would like to use a custom image like with Tabhost and AddWithIcon before. Is there another library to do this?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
but I would like to use a custom image like with Tabhost and AddWithIcon
Bonjour Monsieur @ciginfo
You can do it with TabstripViewPager and CSBuilder like this. Make sure the code is after the tabs are created with TabStrip1.LoadLayout("Page1", "P1"), etc.
B4X:
'Below code must be located after the tabs are created. The tabstrip labels heights can be changed in the Tabstrip layout in designer
    Dim MyList  As List
    MyList.initialize
    MyList.AddAll(Array("brazil.png", "romania.png", "france.png", "fiji.png", "benin.png"))
    For i = 0 To MyList.Size-1
        Dim c As String =MyList.Get(i)
        c=c.SubString2(0,c.IndexOf("."))
        Dim l As Label = GetAllTabLabels(TabStrip1).Get(i)  'label
        l.SingleLine = False
        cs.Initialize.Image(LoadBitmap(File.DirAssets, MyList.Get(i)), 40dip, 40dip, False).Append(CRLF).size(22).Append($"${c}"$)
        cs.PopAll
        l.Text = cs
    Next
 

Attachments

  • TabstripLabelsWithImages.png
    7.8 KB · Views: 116
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
Bravo et merci beaucoup
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…