I've just noticed that the Intellisense for ScrollView wrongly says
This code adds an EditText called edtContent to a ScrollView called svFling to add a 'fling' ability to the EditText. Call flingEnable after LoadLayout.
Note that it is not possible to nest scrolling views. For example a multiline EditText cannot be located inside a ScrollView.
This code adds an EditText called edtContent to a ScrollView called svFling to add a 'fling' ability to the EditText. Call flingEnable after LoadLayout.
B4X:
Sub flingEnable
svFling.Initialize(100)
Dim width As Int = edtContent.Width
Dim height As Int = edtContent.Height
Dim left As Int = edtContent.Left
Dim top As Int = edtContent.Top
edtContent.RemoveView
Activity.AddView(svFling, 0, 0, width, height)
svFling.Left = left
svFling.Top = top
EdtContentFullHeight= svFling.Height
Dim args(3) As Object
args(0) = edtContent ' View
args(1) = -1 ' int width : -1 = FILL_PARENT / MATCH_PARENT = as big as its parent
args(2) = -2 ' int height : -2 = WRAP_CONTENT = large enough to fit its own content
Dim types(3) As String
types(0) = "android.view.View"
types(1) = "java.lang.int"
types(2) = "java.lang.int"
Dim Obj1 As Reflector
Obj1.Target = svFling
Obj1.RunMethod("removeAllViews")
Obj1.RunMethod4("addView", args, types) 'addView(View view, int width, int height)
Obj1.RunMethod2("setFillViewport", "true", "java.lang.boolean")
End Sub
Last edited: