質問

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:scrollbarDefaultDelayBeforeFade="2000"
    android:scrollbarAlwaysDrawVerticalTrack="true">
役に立ちましたか?

解決

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.

他のヒント

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.

check out this link(android:scrollbarFadeDuration)

http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarFadeDuration

or try this..

android:fadeScrollbars="true"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top