Hi all.
I need to change the size of an image in a button contained in a ScroollView.
I used:
if i have
or this
dont change nothing.
Any idea ?
Thank you
I need to change the size of an image in a button contained in a ScroollView.
I used:
B4X:
Dim cs1 As CSBuilder
cs1.Initialize
AppendImage(cs1, LoadBitmap(File.DirAssets, $"${m.Get("immagine")}"$))
cs1.Append(CRLF)
cs1.Color(Colors.White).Font(Font.CreateNewBold(10)).Append($"${m.Get("categoria")}"$)
cs1.PopAll
ButtonSetAttributedText(btnInside,cs1, cs1, cs1.Initialize.Append("disabled"))
B4X:
Sub AppendImage(cs As CSBuilder, bmp As Bitmap)
Dim attachment As NativeObject
attachment = attachment.Initialize("NSTextAttachment").RunMethod("new", Null)
attachment.SetField("image", bmp )
attachment.MakeSize(30.0,30.0)
Dim attributedString As NativeObject
attributedString = attributedString.Initialize("NSAttributedString") _
.RunMethod("attributedStringWithAttachment:", Array(attachment))
Dim no As NativeObject = cs
no.RunMethod("appendAttributedString:", Array(attributedString))
End Sub
Sub ButtonSetAttributedText(btn As Button, NormalText As AttributedString, HighlightedText As AttributedString, _
DisabledText As AttributedString)
Dim no As NativeObject = btn
no.RunMethod("setAttributedTitle:forState:", Array(NormalText, 0))
no.RunMethod("setAttributedTitle:forState:", Array(HighlightedText, 1))
no.RunMethod("setAttributedTitle:forState:", Array(DisabledText, 2))
End Sub
if i have
attachment.MakeSize(30.0,30.0)
or this
attachment.MakeSize(80.0,80.0)
dont change nothing.
Any idea ?
Thank you
Last edited: