B4J Question [ABMaterial] NavigationBar Title Align

rbirago

Active Member
Licensed User
I noticed a curious (and annoying) detail: in a NavigationBar created using the sampled BuildNavigationBar :
B4X:
Sub BuildNavigationBar(page As ABMPage, Title As String, logo As String, ActiveTopReturnName As String, ActiveSideReturnName As String, ActiveSideSubReturnName As String)     'ignore   
    
    ' we have to make an ABMImage from our logo url
    Dim sbtopimg As ABMImage
    sbtopimg.Initialize(page, "sbtopimg", logo, 1)
    sbtopimg.SetFixedSize(236, 49)   

'    page.NavigationBar.Initialize(page, "nav1", ABM.SIDEBAR_MANUAL_HIDEMEDIUMSMALL, Title, True, True, 330, 48, sbtopimg, ABM.COLLAPSE_ACCORDION, "nav1theme")   
    
'    page.NavigationBar.Initialize(page, "nav1", ABM.SIDEBAR_AUTO, Title, True, True, 330, 54, sbtopimg, ABM.COLLAPSE_ACCORDION, "nav1theme")
    page.NavigationBar.Initialize(page, "nav1", ABM.SIDEBAR_MANUAL_ALWAYSHIDE, Title,  True,  True, 330,  54, sbtopimg, ABM.COLLAPSE_ACCORDION, "nav1theme")
        
    page.NavigationBar.TopBarDropDownConstrainWidth = False
    page.NavigationBar.ActiveTopReturnName = ActiveTopReturnName
    page.NavigationBar.ActiveSideReturnName = ActiveSideReturnName
    page.NavigationBar.ActiveSideSubReturnName = ActiveSideSubReturnName
    
    
    
    ' you must add at least ONE dummy item if you want to add items to the topbar in ConnectNaviagationBar
    page.NavigationBar.AddTopItem("DUMMY", "{NBSP}", "", "", False)
    
    ' you must add at least ONE dummy item if you want to add items to the sidebar   
    page.NavigationBar.AddSideBarItem("DUMMY", "{NBSP}", "", "")
End Sub
I added 2 menu items using visibility=true
The result on my browser is this:
title center.png

As you can see the title is centered. If I reduce just a little the browser's window the result is this:
Title left.png

Now the title is left aligned. There is no reason to save right space. At the opposite when the browser's window is larger should be better to left align the title to have more space for menu items. Don't you agree? Is there a workaround to force title to be left aligned?
thank you
Roberto
 

Harris

Expert
Licensed User
If any consolation, I have struggled and have not figured it out.

There have been discussions and attempts, yet the problem exists.

The Top Navigation bar (from my extensive dev tests) is the only section that I can't overcome.

I can live with that...
 
Upvote 0

rbirago

Active Member
Licensed User
I will learn to live with too... but anyway I think that a valid framework as ABMaterial have to be implemented on the basis of the continuous tests of us (developers) to become day by day better to invite people to use it. I want to trust in it. Am I too optimist?
Roberto
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
ABMATERIAL uses and behaves by Google's Material guidelines.
What you are experiencing is due to the Framework responsiveness to the page size change.
In my projects I ended up by using my self-brewed Navigation bar, but this also implies that I must also manage all the page size changes like from showing in a mobile versus desktop.
 
Upvote 0

rbirago

Active Member
Licensed User
As I wrote before: I will accept this non-linear alignment, hoping that in some future time the ABMaterial's author finds a better solution.
The workaround of rewriting the Navigation Bar is for me an heavy choice.
Roberto
 
Upvote 0

Cableguy

Expert
Licensed User
As I wrote before: I will accept this non-linear alignment, hoping that in some future time the ABMaterial's author finds a better solution.
The workaround of rewriting the Navigation Bar is for me an heavy choice.
Roberto
Not that heavy and a lot more versatile...
Take a look here
 
Upvote 0
Top