Android Question How to add image to button with text ?

mr.gedo

Member
Hello everyone

how can i add image with text to the button like this ?

unnamed (1).png
 

asales

Well-Known Member
Licensed User
CSBuilder:
B4X:
    Dim cs As CSBuilder
    cs.Initialize
    cs.Image(LoadBitmap(File.DirAssets, "myimage.png"), 40dip, 40dip, False).Append(CRLF).Append("Police")
    cs.PopAll
    btnImg.Text = cs
button1.png
 
Upvote 0

oparra

Well-Known Member
Licensed User
B4X:
    cs.Image(LoadBitmap(File.DirAssets, "myimage.png"), 40dip, 40dip, True)
    cs.Append(Chr(160))
    cs.VerticalAlign(-8dip)
    cs.Append("Police")

    cs.VerticalAlign(-8dip)
    cs.Append("Police")
    cs.Append(Chr(160))
    cs.Image(LoadBitmap(File.DirAssets, "myimage.png"), 40dip, 40dip, True)

cs.Image(LoadBitmap(File.DirAssets, "myimage.png"), 40dip, 40dip, True)

True = Baseline
 
Upvote 0
Top