【问题标题】:Scroll bar of PagedListView from left side to right side of content in AndroidAndroid中PagedListView从内容左侧到右侧的滚动条
【发布时间】:2018-09-07 05:24:29
【问题描述】:

如何将 android PagedListView 的滚动条(包括向上和向下翻页箭头)从内容的左侧移动到右侧。任何帮助表示赞赏。

【问题讨论】:

  • 您使用的是 RTL 布局吗?
  • @TheWanderer 没有 RTL 布局。我在我的 PagedListView 中显示了项目的数量,我希望将向上翻页和向下翻页箭头移动到右侧。
  • 你在你的问题中说你希望他们在右边。您还说滚动条,而不是分页箭头。是哪个?
  • @TheWanderer 是的,我想移动滚动条,包括向上翻页和向下翻页箭头移动到右侧。

标签: android android-layout android-pagedlistview


【解决方案1】:

我不完全确定为什么没有记录,但它看起来像 you can specify the side in XML

示例:

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

这可能不起作用,因为我实际上并没有看到滚动条的 LayoutParams 在更改后被设置。如果没有,您可以在 Java 中自己进行一些反射:

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);

【讨论】:

    猜你喜欢
    • 2017-05-09
    • 2023-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多