Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show the Scrollbar in a NestedScrollView

Hey i implemented a NestedScrollView in an Activity, but i cant show the scrollbar like i do in a ScrollView, can you guys.

How can I show it?

<android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/appBar">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:orientation="vertical"
            android:paddingLeft="@dimen/dimen_2"
            android:paddingRight="@dimen/dimen_2">
        </LinearLayout>
</android.support.v4.widget.NestedScrollView>
like image 915
Kokusho Avatar asked Sep 25 '16 14:09

Kokusho


People also ask

What is nested scroll view?

NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.

What is nested scroll view in flutter?

The Flutter documentation defines NestedScrollView as “A scrolling view inside of which can be nested other scrolling views, with their scroll positions being intrinsically linked.” This means that with NestedScrollView , you get two scrolling areas. One is the header part and the other is its body part.

What is ScrollView layout?

In Android, a ScrollView is a view group that is used to make vertically scrollable views. A scroll view contains a single direct child only. In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it.


1 Answers

Use the android:scrollbars attribute.

Such as:

android:scrollbars="vertical"

android:scrollbars="horizontal"

android:scrollbars="vertical|horizontal"

For example:

<android.support.v4.widget.NestedScrollView
    android:id="@+id/foo"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical">

</android.support.v4.widget.NestedScrollView>
    

Documentation link: https://developer.android.com/reference/android/view/View.html#attr_android:scrollbars

like image 51
Michael Peterson Avatar answered Sep 16 '22 16:09

Michael Peterson