Android Question AS SegmentedTab - Any way to change a tab bitmap dynamically?

adrianfreitas

Member
Licensed User
Longtime User
I'm new using this library and I haven't found a method that allows me to change the icon (bitmap) after the tabs have been created. Does anyone have any tips on how to do this?
By the way... it's a great library and I'd like to take this opportunity to thank the author and recommend it to others.
A detail in case the author sees this post: it seems to me that the quality of the bitmap deteriorates if the 'FontToBitmap' method is used.
Thank in advance for any help
 

Alexander Stolte

Expert
Licensed User
Longtime User
Download V1.12
B4X:
    'Changes the icon
    ASSegmentedTab2.GetTab(0).Icon = ASSegmentedTab2.FontToBitmap(Chr(0xE195),True,15,xui.Color_White)
    
    'Removes the icon and sets a text
    ASSegmentedTab2.GetTab(1).Icon = Null
    ASSegmentedTab2.GetTab(1).Text = "Test"
    
    'Makes the changes visible
    ASSegmentedTab2.RefreshTabs

A detail in case the author sees this post: it seems to me that the quality of the bitmap deteriorates if the 'FontToBitmap' method is used.
In that case you have to play with the text size for the function. The best is still to add icons without this function.
 
Upvote 0

adrianfreitas

Member
Licensed User
Longtime User
Hello Alexander!! Thank you very much for your help!
In fact, after trying out some solutions, I really liked your library as a 'toolbar' for the app I'm making. But I need a badge with the icon in one of the tabs.
To do this I'm using 'FontToBitmap', using a FontAwsome icon but including the badge.
I'll try to do it the way you indicated - because there is a visual difference in the icon of this tab in terms of quality.

obs: I read the posts referring to the library but somehow the one you copied went unnoticed. Sorry about that.
 
Upvote 0
Top