turing-tech / MaterialScrollBar

An Android library that brings the Material Design 5.1 sidebar to pre-5.1 devices.
Apache License 2.0
779 stars 126 forks source link

Scrollbar isn't showing #41

Closed Nxt3 closed 7 years ago

Nxt3 commented 8 years ago

No matter what I do, I simply can't get the MaterialScrollBar to show.

I've tried using the XML way of inserting the scrollbar and the programmatic way.

Here is my XML

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/activity_background">

    <me.ccrama.redditslide.Views.GeneralSwipeRefreshLayout
        android:id="@+id/activity_main_swipe_refresh_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/vertical_content"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:scrollbars="vertical" />

            <com.turingtechnologies.materialscrollbar.TouchScrollBar
                android:id="@+id/dragScrollBar"
                app:recyclerView="@id/vertical_content"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                app:lightOnTouch="true"
                app:barThickness="4"
                android:layout_alignParentTop="true"
                android:layout_alignParentEnd="true" />
        </RelativeLayout>

    </me.ccrama.redditslide.Views.GeneralSwipeRefreshLayout>
</FrameLayout>

And here is how I would create it in the class:

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
        v = localInflater.inflate(R.layout.fragment_verticalcontenttoolbar, container, false);

        rv = ((RecyclerView) v.findViewById(R.id.vertical_content));
        TouchScrollBar msb = new TouchScrollBar(getActivity(), rv, true);

        rv.setLayoutManager(mLayoutManager);
        rv.getLayoutManager().scrollToPosition(0);
        doAdapter(); //sets the adapter on rv
        return v;
    }

No matter what--nothing shows. What am I doing wrong?

turing-tech commented 8 years ago

I have a couple of idea that I can try. Give me a bit and I'll see what's going on.

Nxt3 commented 8 years ago

Thank you!

turing-tech commented 8 years ago

I just double-checked and in theory that setup should work. If you'd like to provide more of the code about how the fragment is created and included I'd be happy to troubleshoot further.

Nxt3 commented 8 years ago

Source can be found here.

Nxt3 commented 8 years ago

Any ideas?

turing-tech commented 8 years ago

Yeah, sorry. I've been really busy. I'm going to look at it this afternoon.

Nxt3 commented 8 years ago

No worries, I totally understand.

turing-tech commented 8 years ago

So for the programmatic case it is being added but it just can't be seen. (You can drag on the right side of the rv and get a drag out of it) To be frank I can't really debug that for you since the adapter alone is over 3000 lines. What I suspect is happening is that somewhere the scroll detection is failing or has been replaced or the view is being hidden somehow. If you'd like to fork this lib and test out changes by disabling some of the fade out and hide features to make sure the lib isn't hiding itself for some reason I'd suggest doing so. I wish you luck, and sorry I can't be more helpful.

Nxt3 commented 8 years ago

Don't worry about it! I appreciate your comments on it though. Hopefully I can figure it out. That isn't my code so I'm as unfamiliar with it as you are. :P

Again, thank you--take care!

turing-tech commented 8 years ago

Best of luck :P