I want to have some ToggleButtons in my activity. They have to be small, but it seems that the "led lamp" in the middle of the button is not relative to the width of the button.
Any ideas how to fix this?
(see sample code & image below)
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim i,y As Int
y=0
For i=100 To 10 Step -10
Dim tb As ToggleButton
tb.Initialize("")
activity.AddView(tb,100dip,y,i*1dip,i*1dip)
tb.TextOff=i
tb.TextOn=i
tb.TextSize=8
y=y+tb.Height
Next
End Sub
I think you cannot change the led size of the default ToggleButton.
But you can use workarounds in changing the buttons drawable.
In the attached test program you find four different possibilities.
- with 2 different BitmapDrawables
- with a GradientDrawable
- with a ColorDrawable