boten Active Member Licensed User Longtime User Sep 15, 2011 #1 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) Code: 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 Attachments togs.jpg 4.1 KB · Views: 657
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) Code: 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
klaus Expert Licensed User Longtime User Sep 15, 2011 #2 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 Best regards. Attachments TestToggleButton.zip TestToggleButton.zip 9.7 KB · Views: 695 TestToggleButtons.jpg 16.9 KB · Views: 854 Upvote 0
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 Best regards.
boten Active Member Licensed User Longtime User Sep 25, 2011 #3 Thx Klaus. I switched to imageviews with changing bitmaps. Upvote 0