I want to have my Scrollview always visible as you can see in the photo
The only problem is that I can manage to make the scrollbar background (this grey color) but not the white part that when you scroll it also scrolls. How can I make the white part also working?
My xml looks like this
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android=";
xmlns:app=";
xmlns:tools=";
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity">
<!--I had to add this extra ScrollView otherwise the whole screen is not getting scrolled -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_marginEnd="15dp"
android:scrollbarThumbVertical="@color/white"
android:scrollbarTrackVertical="@color/greyed_out"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:scrollbarSize="30dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="30dp">
<other views...>
I have this line here android:scrollbarThumbVertical="@color/white"
but still nothing happens.
I want to have my Scrollview always visible as you can see in the photo
The only problem is that I can manage to make the scrollbar background (this grey color) but not the white part that when you scroll it also scrolls. How can I make the white part also working?
My xml looks like this
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android/apk/res/android"
xmlns:app="http://schemas.android/apk/res-auto"
xmlns:tools="http://schemas.android/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity">
<!--I had to add this extra ScrollView otherwise the whole screen is not getting scrolled -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_marginEnd="15dp"
android:scrollbarThumbVertical="@color/white"
android:scrollbarTrackVertical="@color/greyed_out"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:scrollbarSize="30dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="30dp">
<other views...>
I have this line here android:scrollbarThumbVertical="@color/white"
but still nothing happens.
1 Answer
Reset to default 0I fixed my issue by removing completely NestedScrollView
and had my ScrollView
as the top element.