Subject: Routines to managing ScrollView properties.
Sub: setVerticalScrollBarEnabled
Description: Displays or hides the vertical ScrollBar of the ScrollView.
'displays or hides the VerticalScrollBar of the ScrollView
Sub setVerticalScrollBarEnabled(v As View, Enabled As Boolean)
Dim jo = v As JavaObject
jo.RunMethod("setVerticalScrollBarEnabled", Array As Object (Enabled))
End Sub
Tags: setVerticalScrollBarEnabled,
Sub: setVerticalFadingEdgeEnabled
Description: Enables the vertical fading edges (shadows at top and bottom) of the ScrollView.
'enables the VerticalFadingEdge of the ScrollView
'the VerticalFadingEdges are the 'shadows' on top and bottom of the ScrollView
Sub setVerticalFadingEdgeEnabled(v As View, Enabled As Boolean)
Dim jo = v As JavaObject
jo.RunMethod("setVerticalFadingEdgeEnabled", Array As Object (Enabled))
End Sub
Tags: setVerticalFadingEdgeEnabled
Sub: getVerticalScrollbarPosition
Description: Gets the vertical Scrollbar position of the ScrollView.
'Gets the vertical Scrollbar position of the ScrollView
' SCROLLBAR_POSITION_DEFAULT = 0 position defined by the operating system
' SCROLLBAR_POSITION_LEFT = 1
' SCROLLBAR_POSITION_RIGHT = 2
Sub getVerticalScrollbarPosition(v As View) As Int
Dim jo = v As JavaObject
Return jo.RunMethod("getVerticalScrollbarPosition", Null)
End Sub
Tags: getVerticalScrollbarPosition, setVerticalScrollbarPosition
Sub: setVerticalScrollbarPosition
Description: Sets the vertical Scrollbar position of the ScrollView.
'Sets the vertical Scrollbar position of the ScrollView
' SCROLLBAR_POSITION_DEFAULT = 0 position defined by the operating system
' SCROLLBAR_POSITION_LEFT = 1
' SCROLLBAR_POSITION_RIGHT = 2
Sub setVerticalScrollbarPosition(v As View, Position As Int)
Dim jo = v As JavaObject
jo.RunMethod("setVerticalScrollbarPosition", Array As Object (Position))
End Sub
Sub: getScrollBarStyle
Description: Gets the ScrollBar style.
'Gets the ScrollBar style
' SCROLLBARS_INSIDE_OVERLAY = 0 (0x00000000)
' SCROLLBARS_INSIDE_INSET = 16777216 (0x01000000)
' SCROLLBARS_OUTSIDE_INSET = 50331648 (0x03000000)
' SCROLLBARS_OUTSIDE_OVERLAY = 33554432 (0x02000000)
Sub getScrollBarStyle(v As View) As Int
Dim jo = v As JavaObject
Return jo.RunMethod("getScrollBarStyle", Null)
End Sub
Tags: getScrollBarStyle, setScrollBarStyle
Sub: setScrollBarStyle
Description: Sets the ScrollBar style.
'Sets the ScrollBar style
' SCROLLBARS_INSIDE_OVERLAY = 0 (0x00000000)
' SCROLLBARS_INSIDE_INSET = 16777216 (0x01000000)
' SCROLLBARS_OUTSIDE_INSET = 50331648 (0x03000000)
' SCROLLBARS_OUTSIDE_OVERLAY = 33554432 (0x02000000)
Sub setScrollBarStyle(v As View, Style As Int)
Dim jo = v As JavaObject
jo.RunMethod("setScrollBarStyle", Array As Object (Style))
End Sub
Sub: getOverScrollMode
Description: Gets the OverScrollMode mode of the ScrollView, a small movement when reaching the top or the bottom during scrolling.
'gets the OverScrollMode mode of the ScrollView
' OVER_SCROLL_ALWAYS = 0
' OVER_SCROLL_IF_CONTENT_SCROLLS = 1
' OVER_SCROLL_NEVER = 2
Sub getOverScrollMode(v As View) As Int
Dim jo = v As JavaObject
Return jo.RunMethod("getOverScrollMode", Null)
End Sub
Tags: getOverScrollMode, setOverScrollMode
Sub: setOverScrollMode
Description: Sets the OverScrollMode mode of the ScrollView, a small movement when reaching the top or the bottom during scrolling.
'sets the OverScrollMode mode of the ScrollView
' OVER_SCROLL_ALWAYS = 0
' OVER_SCROLL_IF_CONTENT_SCROLLS = 1
' OVER_SCROLL_NEVER = 2
Sub setOverScrollMode(v As View, Mode As Int)
Dim jo = v As JavaObject
jo.RunMethod("setOverScrollMode", Array As Object (Mode))
End Sub
Sub: getScrollBarDefaultDelayBeforeFade
Description: Gets the ScrollBarDefaultDelayBeforeFade of the ScrollView in milliseconds.
The DelayBeforeFade is the time before the ScrollBar disappears.
'sets the ScrollBarDefaultDelayBeforeFade of the ScrollView in milliseconds
'DelayBeforeFade is the time before the ScrollBar disappears
Sub getScrollBarDefaultDelayBeforeFade(v As View) As Int
Dim jo = v As JavaObject
Return jo.RunMethod("getScrollBarDefaultDelayBeforeFade", Null)
End Sub
Tags: getScrollBarDefaultDelayBeforeFade, setScrollBarDefaultDelayBeforeFade
Sub: setScrollBarDefaultDelayBeforeFade
Description: Sets the ScrollBarDefaultDelayBeforeFade of the ScrollView in milliseconds.
The DelayBeforeFade is the time before the ScrollBar disappears.
'sets the ScrollBarDefaultDelayBeforeFade of the ScrollView in milliseconds
'DelayBeforeFade is the time before the ScrollBar disappears
Sub setScrollBarDefaultDelayBeforeFade(v As View, Duration As Int)
Dim jo = v As JavaObject
jo.RunMethod("setScrollBarDefaultDelayBeforeFade", Array As Object (Duration))
End Sub
Sub: getScrollBarFadeDuration
Description: Gets the ScrollBarFadeDuration of the ScrollView in milliseconds.
The ScrollBarFadeDuration is the fading duration (duration of the slow disappearing).
'gets the ScrollBarFadeDuration of the ScrollView in milliseconds
'ScrollBarFadeDuration is the fading duration (slowly disappearing)
Sub getScrollBarFadeDuration(v As View) As Int
Dim jo = v As JavaObject
Return jo.RunMethod("getScrollBarFadeDuration", Null)
End Sub
Tags: getScrollBarFadeDuration, setScrollBarFadeDuration
Sub: setScrollBarFadeDuration
Description: Sets the ScrollBarFadeDuration of the ScrollView in milliseconds.
The ScrollBarFadeDuration is the fading duration (duration of the slow disappearing).
'sets the ScrollBarFadeDuration of the ScrollView in milliseconds
'ScrollBarFadeDuration is the fading duration (slowly disappearing)
Sub setScrollBarFadeDuration(v As View, FadeDuration As Int)
Dim jo = v As JavaObject
jo.RunMethod("setScrollBarFadeDuration", Array As Object (FadeDuration))
End Sub
Sub: getScrollBarSize
Description: Gets the ScrollBar size in pixels, unfortunately this seems not working, no effect on my devices.
'Gets the ScrollBar size in pixels
' unfortunately this seem not working, no effect on my devices
Sub getScrollBarSize(v As View) As Int
Dim jo = v As JavaObject
jo.RunMethod("getScrollBarSize", Null)
End Sub
Tags: getScrollBarSize, setScrollBarSize
Sub: setScrollBarSize
Description: Sets the ScrollBar size in pixels, unfortunately this seem not working, no effect on my devices.
'Sets the ScrollBar size in pixels
' unfortunately this seem not working, no effect on my devices
Sub setScrollBarSize(v As View, Size As Int)
Dim jo = v As JavaObject
jo.RunMethod("setScrollBarSize", Array As Object (Size))
End Sub
Sub: getVerticalFadingEdgeLength
Description: Gets the length, in pixels, of the fading edge (the shadows on top and bottom of the ScrollView).
'Gets the length, in pixels, of the fading edge (the shadows on top and bottom of the ScrollView
Sub getVerticalFadingEdgeLength(v As View) As Int
Dim jo = v As JavaObject
Return jo.RunMethod("getVerticalFadingEdgeLength", Null)
End Sub
Tags: getVerticalFadingEdgeLength
Dependencies: JavaObject library.
Documentation:
http://developer.android.com/reference/android/view/View.html
Tags: ScrollView, ScrollBar, setVerticalScrollBarEnabled,
The routines above are desiged as independant routines.
If you want to set several propeties at the same time you could do it in a 'simpler' way directly in the code without calling each routine separately :
Dim jo = scvText As JavaObject
jo.RunMethod("setVerticalScrollbarPosition", Array As Object (1)) ' position left
jo.RunMethod("setVerticalFadingEdgeEnabled", Array As Object (True))
jo.RunMethod("setScrollBarDefaultDelayBeforeFade", Array As Object (2000))
jo.RunMethod("setScrollBarFadeDuration", Array As Object (2000))
Attached a small test project (written with B4A version 3.80).