Make scrollbars flash from code (like iOS flashScrollIndicators)
android, scrollbar, scrollview
Solution
I solved a similar problem by forcing it to scroll up and down directly after each other.
scrollView.scrollBy(0, 1);
scrollView.scrollBy(0, -1);
This causes the scroll view to show the vertical scrollbar, unless there is nothing to scroll.
Problem
In iOS there is the `flashScrollIndicators` method on the `UIScrollView` class that allows you to make the scrollbars flash briefly like they do when the view is first displayed. I can't find in the documentation the Android equivalent to this, to make the scrollbars flash briefly on scrollable views (ScrollView, ListView, WebView, etc). I tried issuing a `requestLayout()` on the view, but that didn't work. The reason I'm asking this, is because my views are contained in a `ViewPager` and when the user swipes to a different page, that page has often already been drawn and doesn't flash the scrollbars. answering my own question here The method is called `awakenScrollBars` and is defined in the `View` class. Unfortunately the method is `protected` so you will have to subclass the ScrollView, ListView or whatever view you want to have its scrollbars flashed. Alternatively, the public methods `scrollTo` and `scrollBy` also flash the scrollbars but only if the scroll position has actually changed. So f.e. `listView.scrollBy(0,0)` won't work and `listView.scrollTo(0,0)` only works if the view wasn't already at the top. If are unable to subclass the view, the following seems to work, although admittedly it's kind of a hack: ``` view.setVisibility(View.INVISIBLE); view.setVisibility(View.VISIBLE); ``` Setting the view to invisible and then immediately to visible again doesn't seem to cause any redraws, but it has the side-effect of triggering the scrollbar flashing.