Android custom view that uses a ruler for picking the number from given range.
Easy to integrate:
An Android library written by kevalpatel2106.
Source: https://github.com/kevalpatel2106/android-ruler-picker
Library docs (thanks to @Informatix for the libdoc-generator):
B4ARulerPicker
Author: Github: kevalpatel2106, Wrapped by: moster67/Mikael Osterhed
Version: 0.2
Hope you like it.
Easy to integrate:
- Add the attached libraries to your Additional Library folder. Refresh the library pane and select the library.
- Add the view in your designer as a custom view.
- Add properties, functions in your code
- Add events in your code to listen for value changes.
- A sample project is included too.
- Change width, height, color, distance between indicators.
- Change the color and size of the texts in the ruler dynamically from your code.
An Android library written by kevalpatel2106.
Source: https://github.com/kevalpatel2106/android-ruler-picker
Library docs (thanks to @Informatix for the libdoc-generator):
B4ARulerPicker
Author: Github: kevalpatel2106, Wrapped by: moster67/Mikael Osterhed
Version: 0.2
- B4ARulerPicker
- Events:
- OnIntermediateValueChanged (value As Int)
- OnValueChanged (value As Int)
- Fields:
- ba As BA
- Functions:
- BringToFront
- DesignerCreateView (base As Panel, lw As Label, props As Map)
- GetCurrentValue As Int
get current value - GetIndicatorIntervalWidth As Int
Get distance between two indicator. - GetIndicatorWidth As Float
Width of the indicator. - GetLongIndicatorHeightRatio As Float
Ratio of long indicator height to the ruler height. - GetRulerTextSize As Float
Size of the text of ruler in pixels. - GetShortIndicatorHeightRatio As Float
Ratio of short indicator height to the ruler height. - Initialize (arg1 As String)
- Invalidate
- Invalidate2 (arg0 As android.graphics.Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetIndicatorHeight (longHeightRatio As Float, shortHeightRatio As Float)
Set the height of the long and short indicators.
-longHeightRatio: Ratio of long indicator height to the ruler height. This value must be between 0 to 1.
The value should greater than mShortIndicatorHeight. Default value is 0.6 (i.e. 60%). If the value is 0, indicator
won't be displayed. If the value is 1, indicator height will be same as the ruler height.
-shortHeightRatio: Ratio of short indicator height to the ruler height. This value must be between 0 to 1.
The value should less than mLongIndicatorHeight. Default value is 0.4 (i.e. 40%). If the value is 0, indicator
won't be displayed. If the value is 1, indicator height will be same as the ruler height. - SetIndicatorIntervalDistance (indicatorIntervalPx As Int)
Set the spacing between two vertical lines/indicators. Default value is 14 pixels.
Distance in pixels. This cannot be negative number or zero.
ex: 14dip - SetIndicatorWidth (width As Int)
Set the width of the indicator line in the ruler
Use dip (ex: 2dip) - SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- setMinMaxValue (minValue As Int, maxValue As Int)
Set the maximum value to display on the ruler. This will decide the range of values and number of indicators that ruler will draw.
minValue - Value to display at the left end of the ruler. This can be positive, negative or zero. Default minimum value is 0.
maxValue - Value to display at the right end of the ruler. This can be positive, negative or zero. This value must be greater than min value. Default minimum value is 100. - setRulerTextColor As Int
- SetRulerTextSize (textSize As Int)
Set the size of the text that displays the values in the ruler.
(Text size dimension) - SetRulerValue (value As Int)
set ruler (initial) value - SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- BringToFront
- Properties:
- Background As android.graphics.drawable.Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- IndicatorColor As Int
Color integer value of the indicator color in the ruler. - Left As Int
- MaxValue As Int [read only]
Get the maximum value displayed on the ruler. - MinValue As Int [read only]
Get the minimum value displayed on the ruler. - NotchColor As Int
Change the color off the notch at the top of the ruler. - Padding As Int()
- Parent As Object [read only]
- RulerTextColor As Int [write only]
Change the color of the text that displays the values in the ruler. - Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- Background As android.graphics.drawable.Drawable
- Events:
Hope you like it.
Attachments
Last edited: