Android Question Tabbed UI - how to with larger image and text underneath image

mfstuart

Active Member
Licensed User
Longtime User
I found this image with a Google search. It's a mockup.
1630535152155.png

I'd like to mimic the top part (outlined in red), the tabbed UI look and functionality.
I've tried the TabStripViewPager by using the Chr() with the text and setting the lbl.TypeFace = TypeFace.FONTAWESOME.
With this you can't set the image size and you can't put the image on top of the text.

Anyone have any idea on how to replicate the UI and functionality like the attached image?

Thanx,
Mark Stuart
 

Mahares

Expert
Licensed User
Longtime User
Anyone have any idea on how to replicate the UI and functionality like the attached image?
This will do you for you. I am using 5 images in asset folder. cs is CSBuilder
B4X:
'Below code must be located after the tabs are created.
    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
    
    For Each lbl As Label In GetAllTabLabels(TabStrip1)  'based on 5 tabs
        lbl.Width = 20%x
    Next
 

Attachments

  • TabstripLabelsWithImages090121.png
    TabstripLabelsWithImages090121.png
    10.2 KB · Views: 125
Upvote 1

mfstuart

Active Member
Licensed User
Longtime User
This will do you for you. I am using 5 images in asset folder. cs is CSBuilder
B4X:
'Below code must be located after the tabs are created.
    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
   
    For Each lbl As Label In GetAllTabLabels(TabStrip1)  'based on 5 tabs
        lbl.Width = 20%x
    Next
Thank you. I will try your code today.
 
Upvote 0
Top