Android Question IconButton - Add a icon or an Picture to a button

busmatic

Member
Licensed User
Hi Manfred.

How can I put an icon above the text, that is, use a method button.SetIcon(Top, BitmapDrawable)

Thanks

Regards
 

busmatic

Member
Licensed User
The iconbutton library is very good, too bad you don't have the option to put the icon to the Top or Bottom position :(.

There will be some other library or example that can do what I ask ? :rolleyes:

Regards
 

emexes

Well-Known Member
Licensed User
Other views have Click events too. Especially Panels. You could try using those, perhaps putting a click-capture transparent panel over a custom, manually-constructed button. You can construct this button using images, bitmaps, labels, FontAwesome etc icons.
 

busmatic

Member
Licensed User
Emexes,

Thank you

Use your recommendation and now work with this code

B4X:
cd1.Initialize(Colors.RGB(7,66,158), 5dip)
    panel1.Background     = cd1
    label1.Text         = "INFORMACION"
    label1.TextColor     = Colors.White
    label1.Gravity      = Bit.Or(Gravity.CENTER, Gravity.CENTER_HORIZONTAL)
    imageView1.Bitmap    = LoadBitmap(File.DirAssets,"settings.png")
Regards
 
Top