I have an Inconbutton with a circle layout. See the code below. The microphone picture should be smaller than the button, so that you can see the microphone on a blue disc.
On a device with lower resolution it works perfectly. On one with higher resolution you see only part of it. I hope the screenshots make it clear.
What can I do?
Thanks a lot.
On a device with lower resolution it works perfectly. On one with higher resolution you see only part of it. I hope the screenshots make it clear.
What can I do?
Thanks a lot.
B4X:
Dim b As IconButton
Dim rad As Int = 40dip
b.initialize ("touchbtn")
c=Main.a100color
Dim cd As ColorDrawable
cd.Initialize (c,rad)
b.Background=cd
Dim bb As Bitmap
bb.Initialize(File.DirAssets,"ic_microphone_black_48dp.png")
bb=CreateScaledBitmap (40dip*2/3,40dip*2/3,True)
Dim bm As BitmapDrawable
bm.Initialize (bb)
b.IconPadding=1dip
b.setIcon(False,bm)
Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int, Filter As Boolean) As Bitmap
Dim r As Reflector
Dim b As Bitmap
b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
Array As Object(Original, Width, Height, Filter), _
Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
Return b
End Sub