我创建了自己的适配器 - 实现 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: E/AndroidRuntime(25515): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
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.FrameLayout.onLayout(FrameLayout.java:448)
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 com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:349)
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 com.slidingmenu.lib.CustomViewAbove.onLayout(CustomViewAbove.java:470)
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: E/AndroidRuntime(25515): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
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.view.ViewRootImpl.performLayout(ViewRootImpl.java:1976)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1730)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.Choreographer.doFrame(Choreographer.java:532)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.os.Handler.handleCallback(Handler.java:730)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.os.Handler.dispatchMessage(Handler.java:92)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.os.Looper.loop(Looper.java:137)
09-29 17:23:27.333: E/AndroidRuntime(25515): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-29 17:23:27.333: E/AndroidRuntime(25515): at java.lang.reflect.Method.invokeNative(Native Method)
09-29 17:23:27.333: E/AndroidRuntime(25515): at java.lang.reflect.Method.invoke(Method.java:525)
09-29 17:23:27.333: E/AndroidRuntime(25515): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-29 17:23:27.333: E/AndroidRuntime(25515): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-29 17:23:27.333: E/AndroidRuntime(25515): at dalvik.system.NativeStart.main(Native Method)