Android Question How to show the icon and text on the tab?

gilsonmv

Member
Hello,
I used the Code for GetAllTabLabels: https://www.b4x.com/android/forum/t...ger-better-viewpager.63975/page-2#post-408977, and its worked very well.
I tryed add icons in a listview using FontAwesome library: https://www.b4x.com/android/forum/threads/fontawesome.53990/ ) but it didn't work.
Is there any way to add icons on each tab ?
Thanks


B4X:
Sub Lista_Som
    Dim mShare As String
    ListSom.Clear
    ListSom.SingleLineLayout.Label.TextColor=Colors.cyan 'cor da lista de sons do botão de sons da criação de efeitos
    ListSom.SingleLineLayout.Label.TextSize=14
    '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FA3.Initialize
    FA3.SetFontAwesomeTypefaceByTag(Activity, "Awesome")
    Label3.Typeface = FA3.FontAwesomeTypeface
    Label3.Text = Chr(0xf001)
    ListSom.Visible=True
    '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        Dim ml As List = WildCardFilesList(File.DirRootExternal&"/Playtower/Effects", ".mp3", True, True)
        For l = 0 To ml.Size -1
            Log(ml.Get(l))
            ListSom.AddSingleLine2(Label3.Text&"  "&ml.Get(l),ml.Get(l))
        Next
    End If
End Sub
 

Attachments

  • Tab Sounds.jpg
    Tab Sounds.jpg
    106.3 KB · Views: 112

gilsonmv

Member
Fantastic!!!!
I replaced the ListView to xCustomListView and AddSingleLine2 to AddTextItem.
Then I set xCustomListView's Typeface to FontAwesome and added it in front of the title name.
Thank you very much Erel


B4X:
Sub Lista_Som
    XListSom.Clear
    rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        Dim ml As List = WildCardFilesList(File.DirRootExternal&"/Playtower/Effects", ".mp3", True, True)
        For l = 0 To ml.Size -1
            Log(ml.Get(l))
            XListSom.AddTextItem(Chr(0xF028)&"  "&ml.Get(l),ml.Get(l))
        Next
    End If
End Sub
 

Attachments

  • Tab Sounds2.jpg
    Tab Sounds2.jpg
    107 KB · Views: 102
Upvote 0
Top