Disable ScrollBar in ScrollView

SachGw

Member
Licensed User
Longtime User
How do I disable the scrollbar in scrollview.I think it might be possible with reflection lib.I tried looking into reflection,but since i am still new in Java,I am not able to get it.Could someone please help me out.:sign0104:
 

joseluis

Active Member
Licensed User
Longtime User
I'm interested in this too. But my knowledge of reflection isn't good enough yet. So if nobody provides an answer maybe I'll have to find it out some day, the hard way. :)
 
Upvote 0

joseluis

Active Member
Licensed User
Longtime User
I updated Erel's code to include the disabling of the fading orange glow that appears when you scroll over the end. Now that's clean and simple.

B4X:
Dim r As Reflector
r.Target = ScrollView1
r.RunMethod2("setVerticalScrollBarEnabled", False, "java.lang.boolean")

r.RunMethod2("setOverScrollMode", 2, "java.lang.int" )
' 0 = OVER_SCROLL_ALWAYS, 1 = OVER_SCROLL_IF_CONTENT_SCROLLS, 2 = OVER_SCROLL_NEVER
 
Upvote 0

Mickster

Active Member
Licensed User
Longtime User
Hey,
I'm having difficulty getting this code to work. I have the reflector library and have tried different commands in the past that also showed no effect on my program.

There are no compilation or runtime complaints...nothing happens.

Any thoughts?
 
Upvote 0

Mickster

Active Member
Licensed User
Longtime User
I essentially just copied your code into the end of my routine.

B4X:
Sub txtOffsetsCommentBox_Click
   
   If LoadedFile = "" Then
      CallPromptBox("You must save your program to write comments. Save now?", False, "ForceSave")
      Return
   End If

   blnSetupInfo = True
   SaveNameEdit = False
   TypedString = txtOffsetsCommentBox(intOffsetsCommentBox).Text
   
   QWERTYPanelBackground.visible = True
   QWERTYPanelBackground.bringtofront
   
   Dim txtinter As EditText
   txtinter = Sender
   intOffsetsCommentBox = txtinter.Tag
   
   pnlExpandOffsets.Panel.Height = txtOffsetsCommentBox(intOffsetsCommentBox).Top + pnlExpandOffsets.Height
   pnlExpandOffsets.Width = Activity.Width - 1

   DoEvents
   pnlExpandOffsets.Width = Activity.Width
   pnlExpandOffsets.ScrollPosition = txtOffsetsCommentBox(intOffsetsCommentBox).Top
   
    Dim StopScroll As Reflector
   StopScroll.Target = pnlExpandOffsets
   StopScroll.RunMethod2("setVerticalScrollBarEnabled", False, "java.lang.boolean")
   

End Sub
 
Upvote 0

Mickster

Active Member
Licensed User
Longtime User
Thanks, but the program is too large to post on the forum.

As I mentioned before, I have tried other Reflector commands that also took no effect, such as bitmap recycle. You ever known this to happen before?
 
Upvote 0

Mickster

Active Member
Licensed User
Longtime User
I just put together a quick sample app:

B4X:
Sub Activity_Create(FirstTime As Boolean)

   Dim Scroll As ScrollView
   Scroll.Initialize(Activity.Height + 800)
   Scroll.Panel.Color = Colors.White
   Activity.AddView(Scroll, 0, 0, 100%x, 100%y)
   Dim Stop As Reflector
   Stop.Target = Scroll
   Stop.RunMethod2("setVerticalScrollBarEnabled", False, "java.lang.boolean")
   

End Sub

I ran this on my tablet (Toshiba Thrive) and had the same results that I saw when using the reflection code in my main application. However, I then ran this exact same application on a phone and the code worked perfectly.

The tablet is running HoneyComb and the phone is running 2.x. Is there something in the reflection library that doesn't like HoneyComb?
 
Upvote 0
Top