Android Question Adding icon to ACToolbar

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Installed the AppCompat library now and trying to add an icon to an ACToolbar:

Sub Activity_Create(FirstTime As Boolean)

Dim ACToolBarDark1 As ACToolBarDark

ACToolBarDark1.Initialize("ACToolBar")
ACToolBarDark1.LogoBitmap = LoadBitmap(File.DirAssets, "Test.ico")

This compiles fine with no warnings, but the icon doesn't show on the toolbar.
Tried with .png and .bmp images, but no success.

I looked at various examples, but couldn't get it to work.
Any suggestion how this should be done?

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

OK, sorry, didn't know about that.
I think the ACToolbar shouldn't be added as a control in the Design view as otherwise I can't declare the control in Sub Globals().
So now I have:

B4X:
Sub Globals()
Dim edtID, edtFullName, edtPostcode, edtGP As EditText
Dim btnFirst, btnLast, btnFind, btnShowNext, btnPrevious, btnNext As Button
Dim lblRowCount As Label
Dim ACToolBarDark1 As ACToolBarDark
End Sub

Sub Activity_Create(FirstTime As Boolean)
ACToolBarDark1.Initialize("ACToolBar")
ACToolBarDark1.LogoBitmap = LoadBitmap(File.DirAssets, "Test.png")
'etc. etc.
End Sub

Hope this makes it clearer.


RBS
 
Upvote 0
Top