【问题标题】:Scrollbar in listview [duplicate]列表视图中的滚动条[重复]
【发布时间】:2020-03-09 14:24:59
【问题描述】:

您好,我正在制作一个列表视图,我可以让滚动条显示出来,但它什么也没做。

    <ListView
        android:id="@+id/listView"
        style="@style/CustomTheme"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbarSize="30dip"
        android:scrollbarStyle="outsideInset"
        android:scrollbarThumbVertical="@color/blue"
        android:scrollbarTrackVertical="@drawable/side_nav_bar" />

我怎样才能让它工作?

【问题讨论】:

  • 您期待什么行为?也就是说,它到底是怎么不工作的?
  • 这能回答你的问题吗? Always show scrollbar for ListView
  • 当我在滚动条上拖动拇指时,我希望它滚动列表视图。这并不能回答问题。我可以在拖动列表视图条目时显示它。
  • 你想要 fastScroll* 属性,然后;例如,fastScrollEnabledfastScrollAlwaysVisiblefastScrollThumbDrawable 等。常规滚动条只是一个非交互式指示器。
  • 这回答了我的问题。谢谢!

标签: java android listview scrollbar


【解决方案1】:

好的,所以我需要将 fastScroll 添加到我的活动中。

<ListView
    android:id="@+id/listView"
    style="@style/CustomTheme"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbarSize="30dip"
    android:scrollbarStyle="outsideInset"
    android:fastScrollEnabled="true"
    android:scrollbarThumbVertical="@color/blue"
    android:scrollbarTrackVertical="@drawable/side_nav_bar" />

【讨论】:

    猜你喜欢
    • 2014-08-20
    • 1970-01-01
    • 2013-09-22
    • 2017-09-26
    • 1970-01-01
    • 1970-01-01
    • 2012-11-19
    • 2017-09-15
    相关资源
    最近更新 更多