B4A Library [B4X] [XUI] AS SegmentedTab

Alexander Stolte

Expert
Licensed User
Longtime User
i will be much more thankful to you if you go through it and suggest or make it scrollable,
but then you don't learn it.
  1. Put the ASSegmentedTab to a own form
  2. add a xCustomListView under the ACToolBarLight
  3. use xCustomListView instead of "ListView", i dont know, how to add a panel to a "ListView"
  4. create a new panel
    1. B4X:
      Dim xpnl_seg_Tab_background As B4XView = xui.CreatePanel("")
  5. set a larger width than your ASSegmentedTab width is
    1. B4X:
      xpnl_seg_Tab_background.SetLayoutAnimated(0,0,0,Activity.Width*2,40dip)
  6. load the form with the ASSegmentedTab to this panel
    1. B4X:
      xpnl_seg_Tab_background.LoadLayout("frm_seg_tab")
  7. add this panel to your xCustomListView
    1. B4X:
      CustomListView1.Add(xpnl_seg_Tab_background,"")
For further questions, please make a new thread, I don't want this thread to be endless.
 
Thanks a lot
i will try your suggestion, and also i will start new thread if required
 
Thanks again

I have created new thread at following link

Regards
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
1.04

  • B4A and B4J - Corner Radius Fix
  • Add DesignerProperty CornerRadiusBackground - changes the CornerRadius of the view
  • Add DesignerProperty CornerRadiusSelectionPanel - changes the CornerRadius of the selector
  • Add DesignerProperty PaddingSelectionPanel - set a distance from the corners for the selector
Corner Radius Old VS New:
mBase:
'old way:
ASSegmentedTab2.Base.SetColorAndBorder(ASSegmentedTab2.Base.Color,0,0,10dip) 'make the view rounded
'new way:
ASSegmentedTab2.CornerRadiusBackground = 10dip 'make the view rounded
SelectionPanel:
'old
ASSegmentedTab2.SelectionPanel.SetColorAndBorder(ASSegmentedTab2.SelectionPanel.Color,0,0,10dip)'makes the selector rounded
'new
ASSegmentedTab2.CornerRadiusSelectionPanel = 10dip'makes the selector round
PaddingSelectionPanel:
B4X:
ASSegmentedTab1.PaddingSelectionPanel = 5
Result:
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
1.05

  • Add Seperators - displays seperator items between non selected tabs
    • Add Designer Property "ShowSeperators" - default: False
    • Add UpdateSeperators - commit style changes
    • Add get SeperatorProperties - change the properties and call UpdateSeperators

Examples:
B4X:
ASSegmentedTab1.ShowSeperators = True 'Shows the seperators - or use the Designer Property
ASSegmentedTab1.SeperatorProperties.Width = 2dip 'the width of the seperators
ASSegmentedTab1.SeperatorProperties.Color = xui.Color_Red 'the color of the seperators
ASSegmentedTab1.UpdateSeperators 'commit the style changes
 

Alexander Stolte

Expert
Licensed User
Longtime User
I had another update in the pipeline, I don't know why I didn't publish it back then, version 1.05 is still available as backup in the 1st post.
Update
  • 1.06
    • Performance Improvements
      • Seperators only added if ShowSeperators = True
        • If you set the ShowSeperators = False then the seperators will be removed and vice versa
    • Seperators - Add HeightPercentage - default:50% - 50% from the view height
      • ASSegmentedTab1.SeperatorProperties.HeightPercentage = 50
    • Seperators - Add CornerRadius - default:0 - set the corner radius of the seperators
      • ASSegmentedTab2.SeperatorProperties.CornerRadius = ASSegmentedTab2.SeperatorProperties.Width/2'round seperators
    • Add get SeperatorProperties - gets the seperators height
    • B4J and B4I Resize BugFixes
    • Add set ImageHeight - sets the image Height/Width
 

tufanv

Expert
Licensed User
Longtime User
Update
  • 1.07
    • BugFix - SelectedIndex the index was not set
    • Add set Index - change the index without animation, do the same as SelectedIndex(1,0)
Does this fix the problem where selectedindex changes to selected-1 for some reason? I tried it a while ago and this was happening
 

Rubsanpe

Active Member
Licensed User
Hi in AS SegmentedTab I have tested the option PaddingSelectionPanel = 5 and the result is correct.



The problem is that when the tab is changed the selection is not centred with the indicated margin.



Thanks for your great work on B4X

Rubén
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.11
    • Add get and set AutoDecreaseTextSize - The text size is automatically adjusted to the space, if the text should not fit on one line
AutoDecreaseTextSize
Default: False
B4X:
ASSegmentedTab1.AutoDecreaseTextSize = False

B4X:
ASSegmentedTab1.AutoDecreaseTextSize = True
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.12
    • Add GetTab - Gets the tab text, icon and the text properties
    • Add RefreshTab - If you change something on the tab, then call this
Example:
    '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
 

adrianfreitas

Member
Licensed User
Longtime User
I would like to thank you for your great work and great contribution to the community. I would also like to ask if there is any way to use icon and text at the same time in the tab... I tried to simulate it in your example but without success. Thanks!

I just found your AS Tab Menu... thank you!
 

jahswant

Well-Known Member
Licensed User
Longtime User
I just found your AS Tab Menu... thank you!
You can also try this one :
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.13
    • Add Designer Porperty TabBackgroundColor
    • Add Designer Porperty SelectionColor
    • Add Designer Porperty SeperatorColor
    • Add Designer Porperty TextColor
No idea why these properties were missing... Now they are there and you can reach your goal even faster.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…