简体   繁体   中英

Scroll bar of PagedListView from left side to right side of content in Android

How to move Scroll bar including page up and page down arrows of android PagedListView from left side to right side of the content. Any help is appreciated.

I'm not entirely sure why this isn't documented, but it looks like you can specify the side in XML .

Sample:

<androidx.car.widget.PagedListView
    android:id="@+id/whatever"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:scrollBarGravity="right"
/>

This might not work, since I don't actually see the scrollbar's LayoutParams being set after they're changed. In case it doesn't, you can do this yourself in Java with some reflection:

Field mScrollBarViewField = PagedListView.class.getDeclaredField("mScrollBarView");
mScrollBarViewField.setAccessible(true);
PagedScrollBarView mScrollBarView = (PagedScrollBarView) mScrollBarViewField.get(pagedListViewInstance);

FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) mScrollBarView.getLayoutParams();
layoutParams.gravity = Gravity.RIGHT;
mScrollBarView.setLayoutParams(layoutParams);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM