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?
I found the solution, first set the NestedScrollView behaviour to "@string/appbar_scrolling_view_behavior" then, I created a style to show the scrollbars in all NestedScrollViews where I need it.
in styles.xml
:
<resources>
<!-- other styles -->
<style name="NestedScrollBarStyle">
<item name="android:scrollbarFadeDuration">2</item>
<item name="android:scrollbars">vertical</item>
<item name="android:fillViewport">true</item>
<item name="android:orientation">vertical</item>
</style>
</resources>
in the layout:
<android.support.v4.widget.NestedScrollView
style="@style/NestedScrollBarStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/appBar"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<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>
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