android - 谁能认出这个右手可转位蓝棒

标签 android android-listview indexing

你好,我在很多不同的应用程序上看到了这个,我很困惑这是什么,这是 BW 中的图片

mystery widget

我只是想知道它是什么。我知道它是 Blue Barred,可用于向上或向下导航到页面,但任何人都可以告诉我这是什么以及如何使用它的指南吗? 也有可能实现同样的事情,但在其中包含大量文本的 ScrollView 中吗?

最佳答案

该 BlueBar 称为 FastScrollBar,用于在 listview 上启用快速滚动。您在大多数应用程序中看到的栏实际上是默认 FastScrollBar 的主题版本。可以通过设置 listviewenableFastScroll=true 属性在 ListView 上启用它。 例如。

<ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:fastScrollEnabled="true" />

它将在您当前的滚动条上显示一个缩略图。您可以通过为其 thumbscrollbar 提供不同的 drawable,使用自定义 drawable 对其进行样式化。

为此,您必须将这些属性设置到 style.xml 中

<style name="Theme_app" parent="@android:style/Theme.Holo.Light">
    <item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb_holo</item>

 </style>

然后在Drawable中为图片创建一个xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/fastscroll_thumb_pressed_holo" />
    <item android:drawable="@drawable/fastscroll_thumb_default_holo" />
</selector>

请注意,android:fastScrollThumbDrawable 属性仅适用于 Android API 级别 11 及更高版本。

关于android - 谁能认出这个右手可转位蓝棒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15721165/

相关文章:

android - 无法发送到 Cloud Firestore

android - 如何在Flutter中渲染单个像素?

具有可变数量的 subview 的android listview行

objective-c - 按字母顺序自动分组 UITableView

java.util.MissingResourceException : Can't find bundle for base name javax. servlet.LocalStrings

java - Android - 更新联系人

android - ListView 中的三个状态检查 TextView

android - 使用自定义 BaseAdapter 从 ListView 中删除项目

jQuery:.children()[index] 不允许函数调用

python - 具有特定时间范围的 Pandas date_range