Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbar not visible when used inside Nested Scroll View #53

Open
amrfarid140 opened this issue Mar 10, 2017 · 3 comments
Open

Scrollbar not visible when used inside Nested Scroll View #53

amrfarid140 opened this issue Mar 10, 2017 · 3 comments

Comments

@amrfarid140
Copy link

In my Project, I am using CoordinatorLayout + AppbarLayout + CollapsingToolbarLayout... here is the XML for MainActivity:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/main_appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/main_collapsing"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:collapsedTitleGravity="left|center_vertical">

        <FrameLayout
                android:id="@+id/header_fragment_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.7"
                android:paddingTop="50dp">

            </FrameLayout>

            <android.support.v7.widget.Toolbar
                android:id="@+id/drawer_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:theme="@style/ToolbarColoredBackArrow"
                app:popupTheme="@style/AppTheme.PopupOverlay" >
                </android.support.v7.widget.Toolbar>


        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".MainActivity"
    tools:showIn="@layout/app_bar_main"
    android:scrollbars="vertical"
    android:fillViewport="true"
    android:id="@+id/content_main_scroll_view"
    >

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:fitsSystemWindows="true"
        />
</android.support.v4.widget.NestedScrollView>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/main_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/ic_directions"
        app:layout_anchor="@id/main_appbar"
        app:layout_anchorGravity="bottom|end" />

</android.support.design.widget.CoordinatorLayout 

Now I use your scrollbar in one of the fragments with a recyclerView .. fragment XML is


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">


        <controls.CustomFontTextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="20dp"
            android:text="Title: "
            android:textColor="@android:color/black"
            android:textSize="16sp" />

        <Spinner
            android:id="@+id/title_spinner"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:layout_margin="20dp"
            android:background="@drawable/spinner" />
    </LinearLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/staff_directory_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fastScrollEnabled="true"
            />

        <com.futuremind.recyclerviewfastscroll.FastScroller
            android:id="@+id/fastscroll"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"/>

    </RelativeLayout>


</LinearLayout>

Currently, I do exactly as you mentioned in the Wiki to initialize YOUR scrollView. However, it doesn't appear at all.

I would appreciate if you pointed me to the fix.

@micHar
Copy link
Contributor

micHar commented Mar 11, 2017

Do you have enough items in your recycler adapter? It has a mechanism which hides it unless there is something to scroll.

Otherwise, did you try to use it outside of NestedScrollView and it does work? Why do you think it's a problem with that particular widget?

@amrfarid140
Copy link
Author

Yes there is enough items in the adapter. I can see them all loaded. I assumed it's the NestedScrollView as the scrollbar for it shows instead of the alphabetical scrollbar.

Anyways I will try it outside the NestedScrollView and see if it will work.

Thanks for your reply.

@yenenahmet
Copy link

+++ there is also the same problem i have unfortunately not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants