How I can show ScrollView scroll-bar for 2 seconds on activity create?
I just want to show the scrollbar for 2 sec when view is created. Is there any attribute for this?
Actually it show when user touch the screen but I want to show it automatically for a few seconds so user can know this view is scroll-able.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbar开发者_如何学CDefaultDelayBeforeFade="2000"
android:scrollbarAlwaysDrawVerticalTrack="true">
You can either:
Make a call to move the scrollView (e.g. mScrollView.scrollBy(0, 1)) if you don't mind the view scrolling by a pixel. This will call through to onScrollChanged and subsequently awaken the scroll bars. If you call something like scrollBy(0, 0), the scrollView realizes it doesn't need to do anything and won't shown the scroll bars.
Create a subclass of ScrollView the publicly exposes the awakenScrollBars() method, which is protected by default. See here for details.
add the android:id attribute in the xml for ScrollView and in the activity use timer or countdowntimer for 2 sec notification and on completion set the visibility of the ScrollView to invisible.
check out this link(android:scrollbarFadeDuration)
http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarFadeDuration
or try this..
android:fadeScrollbars="true"
精彩评论