我做了一个小库,它展示了如何模仿运行Android Lollipop的股票联系人应用程序的风格,在这里.
似乎在Android 5.1上,快速滚动器看起来与前一个非常不同,并且它太靠近右侧,因此很难使用它.
Android 4.4的屏幕截图:

这是Android 5上的截图:

在Android 5.1上:

我试图浏览Android 5.1的所有"新内容"部分,以及一些相关的类文档,但除了" setFastScrollStyle " 之外我没有找到任何特别的内容.但是,我找不到任何解释如何使用它(加上它来自API 21,所以这可能不是原因).
如何使快速滚动条位于左侧,以便更容易触摸它?
你如何使用setFastScrollStyle?有没有这方面的教程?
android android-listview fastscroll android-scrollbar android-5.0-lollipop
我正在尝试更改滚动条中包含字母的气泡.
BTW的官方名称是什么?
我不是在谈论右侧的fastScrollThumbDrawable或fastScrollTrackDrawable.见下图.
这个答案使用colorAccent.但我不想影响主题.
Huby对如何处理Lollipop 5.1快速滚动的答案给出了改变泡泡位置的部分答案
android fastscroll android-scrollbar material-design android-5.1.1-lollipop
我正在使用a ExpandableListView和BaseExpandableListAdapter我注意到启用fastScroll滚动会遍历各个部分或标题.如果它不是因为它不能正常工作那将是伟大的.将fastScroll通过与在上面滚动的只有一小部分的所有部分进行迭代,刚开始滚动,然后在通过滚动的第一季度的时候,所有的部分滚动到屏幕上,滚动什么也不做.
这是一个演示gif:
我已经检查了这个老帖子android fastScroll只覆盖了列表的一部分,但是对我来说不起作用.
任何人都知道这个错误的另一个解决方法或知道如何强制ExpandableListView fastScroll迭代所有项目而不是部分?
这是示例代码,如果它对您有用.
activity_main.xml中
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ExpandableListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:fastScrollEnabled="true"
android:layout_height="match_parent"></ExpandableListView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
MainActivity.java
public class MainActivity extends AppCompatActivity {
private ExpandableListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = findViewById(R.id.listview);
ExpandableAdapter adapter = new ExpandableAdapter(this, getItems());
listView.setAdapter(adapter);
}
private Map<String, List<String>> getItems() {
Map<String, List<String>> items = new LinkedHashMap<>();
// Loops to create stub items
return items; …Run Code Online (Sandbox Code Playgroud) 我有一个很大的用户列表在AlertDialog中显示为选择列表.这是我用来生成它的代码:
AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
builder.setTitle("User");
builder.setItems(userNames, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int pos) {
//selection processing code
}});
builder.setNeutralButton("Clear", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//clear processing code
}});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
dialog=builder.create();
//next line added as solution
dialog.getListView().setFastScrollEnabled(true);
dialog.show();
Run Code Online (Sandbox Code Playgroud)
userNames是数据库中的一个alphebetical名称列表.
然而,这在大多数情况下非常有效,因为我有超过100个或更多用户,滚动列表有点慢.如何添加快速滚动以便用户可以在需要时跳转到列表中的某个部分?
有没有办法检测ListView是否快速滚动?也就是说,我们可以知道用户何时按下并释放FastScroller?
我正在尝试RecyclerView在我的应用程序中使用其中包含大量数据,并希望快速滚动它,就像它一样ListView.从这个答案的方法为我ListView工作,但不适用于RecyclerView.即使我true在RecyclerView布局中设置快速滚动,它仍然不起作用:
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fastScrollEnabled="true"
android:fastScrollAlwaysVisible="true" />
Run Code Online (Sandbox Code Playgroud)
是否RecyclerView支持Android L移动的快速滚动?在文档中找不到任何相关内容.
android android-listview fastscroll android-5.0-lollipop android-recyclerview
我需要使用自定义背景资源自定义快速滚动字母预览(屏幕截图中的大M),但我找不到任何有关它的文档.你能帮我吗?

在一个应用程序中,我有一个Spinner,有几十个项目.
当用户点击微调器时,会出现一个弹出对话框,显示可能的选择列表.但是,由于存在(排序)数十个项目,我希望用户能够使用快速滚动缩略图(如fastScrollEnabledListView上的属性),类似于在Contacts应用程序中启用的那个.
我试图获取在该弹出对话框中使用的ListView,但我没有找到任何方法来做到这一点.
我创建了自己的适配器 - 实现ListAdapter.我检查了XML中的fastScrollEnabled : android:fastScrollEnabled="true".
但是,当列表/网格被绘制时,我得到了一个ClassCastException:
09-29 17:23:27.333: E/AndroidRuntime(25515): FATAL EXCEPTION: main
09-29 17:23:27.333: E/AndroidRuntime(25515): java.lang.ClassCastException: XAdapter cannot be cast to android.widget.BaseAdapter
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.FastScroller.getSectionsFromIndexer(FastScroller.java:541)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.FastScroller.getThumbPositionForListPosition(FastScroller.java:662)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.FastScroller.onScroll(FastScroller.java:487)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1337)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.GridView.layoutChildren(GridView.java:1301)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.AbsListView.onLayout(AbsListView.java:2012)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.View.layout(View.java:14289)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.ViewGroup.layout(ViewGroup.java:4559)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.View.layout(View.java:14289)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.ViewGroup.layout(ViewGroup.java:4559)
09-29 17:23:27.333: …Run Code Online (Sandbox Code Playgroud)