Enhancing the jRLViews CV Library with a ButtonToolbar CV. A toolbar can contain buttons text or icon and separators.
Despite using icons from the bitmaps located in the dirassets folder, want to use FontAwesome Icons.
Seeking help for: Whilst the fontawesome icons are displayed, encountered following issues:
1. the fontawesome icon aligment is always center_right instead of center.
Tried several options, like a resize sub called using subdelayed after the CV is loaded = no change, or setting the alignment property = no change.
Example fontawesome Android Icon, plus 2 icons from files:
2. when resizing the toolbar till the >> appear, the fontawesome icon is empty when clicking on the >>, wheras the icons created from file are displayed:
Code Snippet creating icon button
The button properties are read from JSON string like for a Menu.
The fontawesome font is stored in an additional jar and added to the Project Attributes.
The CV lib attached, see class ButtonToolbar.
Despite using icons from the bitmaps located in the dirassets folder, want to use FontAwesome Icons.
Seeking help for: Whilst the fontawesome icons are displayed, encountered following issues:
1. the fontawesome icon aligment is always center_right instead of center.
Tried several options, like a resize sub called using subdelayed after the CV is loaded = no change, or setting the alignment property = no change.
Example fontawesome Android Icon, plus 2 icons from files:
2. when resizing the toolbar till the >> appear, the fontawesome icon is empty when clicking on the >>, wheras the icons created from file are displayed:
Code Snippet creating icon button
The button properties are read from JSON string like for a Menu.
The fontawesome font is stored in an additional jar and added to the Project Attributes.
B4X:
...
Dim ic As String = colroot.Get("icon")
' Fontawesome icon is hex string, i.e. 0x.
If ic.StartsWith("0x") Then
b.Tag = ic
b.Font = fx.CreateFontAwesome(b.PrefHeight)
b.Text = Chr(Bit.ParseInt(ic.Replace("0x",""), 16))
b.Alignment = "CENTER"
Else
' Icon from file located in the dirassets folder
AddButtonIcon(b, colroot.Get("icon"), mProps.Get("Transparent"))
End If
End If
' Add the button to the list
l.Add(b)
End If
Next
' Add the list of buttons to the toolbar
mJOToolbar.RunMethodJO("getItems", Null).RunMethod("addAll", Array(l))
' Add the toolbar node to the base
mBase.AddNode(mJOToolbar, 0, 0, 0, 0)
The CV lib attached, see class ButtonToolbar.