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

Situ LLC

Active 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
 

Situ LLC

Active 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 ?

Regards
 
Upvote 0

emexes

Expert
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.
 
Upvote 0

Situ LLC

Active 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
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…