Android Question How to remove the scrollview fadingedge

RayLee

Member
Licensed User
Longtime User
In java, it could be set
B4X:
scrollView1.setHorizontalFadingEdgeEnabled(false)

but i use the code:
B4X:
    Dim reItem As Reflector
    reItem.Target = PnMainContainer ' PnMainContainer is a scrollview object
    reItem.RunMethod2("setHorizontalFadingEdgeEnabled", False, "java.lang.Boolean")

It causes some errors:

java.lang.NoSuchMethodException: setHorizontalFadingEdgeEnabled

How can I invoke this method?
 

DonManfred

Expert
Licensed User
Longtime User
This line is wrong
B4X:
reItem.RunMethod2("setHorizontalFadingEdgeEnabled", False, "java.lang.Boolean")
B4X:
reItem.RunMethod2("setHorizontalFadingEdgeEnabled", False, "java.lang.boolean")

Both lines are identic. And this should help to not change the line? ;-)
 
Upvote 0

RayLee

Member
Licensed User
Longtime User
Thank you!

However after invoked, I found it could not remove the FadingEdge .

:>_<:
 

Attachments

  • DesignIt.zip
    478 KB · Views: 276
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
I think your looking for the overscroll mode

B4X:
reitem.RunMethod2("setVerticalScrollBarEnabled", False, "java.lang.boolean")
reItem.RunMethod2("setOverScrollMode", 2, "java.lang.int" )
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
It depends on what fading you are speaking of and the Android version.
There are two fadings:
- a permanent fading on the edges which remain when the scroll position is not at the beginning or at the end.
- a dynamic fading which appears when you reach either the beginning or the end.
The permanent fading is removed with
r.RunMethod2("setHorizontalFadingEdgeEnabled", False, "java.lang.boolean")
or
r.RunMethod2("setVertivalFadingEdgeEnabled", False, "java.lang.boolean")
but the dynamic fading remains.
To remove both fadings, as reported by barx, use .
r.RunMethod2("setOverScrollMode", 2, "java.lang.int")

On my device with Android 2.3.3 the permanent fading is True by default.
On my device with Android 4.2.2 the permanent fading is False by default.

Attached a small test program.

In the picture you see on the top permanent fading is True and on the bottom permanent fading is False.
 

Attachments

  • ScrollViewFading.png
    ScrollViewFading.png
    6.4 KB · Views: 336
  • TestScrollViewScrollBars.zip
    6 KB · Views: 284
Last edited:
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Nothing is ever straight forward lol. I wasn't aware of this second fade. Put me back on the n00b pile. ;)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Me too, I discovered it and also the differences depending on the Android version when I played with the different functions.
I had never looked at setOverScrollMode before I saw your post.
I have updated my post with your solution.
 
Upvote 0
Top