This class implements ICS Like SeekBars.
Every seekbar is drawn when created so you can set :
- color and size of the button
- color and width of the stroke
- choose if value is shown or not
- choose where is the max value for the vertical one (up or down)
- set the max value and the start value
- enable/disable
Requirements:
- B4A 2.xx
- ABExtDrawing Lib
How to use (example for the horizontal one):
Initialize the class :
then create it :
(Don't forget to add True or False at the end if ou use the vertical class to choose where must be the max value, at the top or the bottom)
You can customize the text showing the value:
You can set a value at any time:
You can set a step value:
in the main activity you can get the selected value:
That's it. Have a look at the demos and send feedback or ideas for enhancements.
Every seekbar is drawn when created so you can set :
- color and size of the button
- color and width of the stroke
- choose if value is shown or not
- choose where is the max value for the vertical one (up or down)
- set the max value and the start value
- enable/disable
Requirements:
- B4A 2.xx
- ABExtDrawing Lib
How to use (example for the horizontal one):
Initialize the class :
B4X:
Sub Globals
Dim SBT1 As mbHSeekBar
End Sub
then create it :
B4X:
'Activity, Module,EventName,Left,Top,Width,Height,StrokeWidth,StrokeDefautColor,Color,TextVisible,InitValue,MaxValue
SBT1.Initialize(Activity,Me,"SBT_Click",1%x,10%y,98%x,52dip,5dip,Colors.DarkGray,Colors.RGB(0xcc,0x00,0x00),True,200,255)
(Don't forget to add True or False at the end if ou use the vertical class to choose where must be the max value, at the top or the bottom)
You can customize the text showing the value:
B4X:
SBT1.CustomizeText(Colors.Red,22,Typeface.DEFAULT_BOLD)
You can set a value at any time:
B4X:
SBT1.setValue(33)
You can set a step value:
B4X:
SBT1.stepValue = 10 ' value will be rounded from 10 to 10
in the main activity you can get the selected value:
B4X:
Sub SBT_Click(returnValue)
Activity.Title = "Value is " & returnValue
End Sub
That's it. Have a look at the demos and send feedback or ideas for enhancements.
Attachments
Last edited: