turing-tech / MaterialScrollBar

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

ScrollBar to left when RecyclerView Empty #22

Closed samy-baili closed 8 years ago

samy-baili commented 8 years ago

Hi,

I got this issue only when the RecyclerView is empty:

<android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/reveal_notification">

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

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:background="@color/search_bar"/>
        </RelativeLayout>

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

screenshot_20160128-101009

samy-baili commented 8 years ago

AlignParentRight fix my problem:

RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)mMaterialScrollBar.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
mMaterialScrollBar.setLayoutParams(params);
Rainer-Lang commented 8 years ago

@samy-baili Use in xml in RecyclerView: android:layout_alignParentEnd="true"