[英]Cannot open XML files in Graphical Layout: FakeAdapter cannot be cast to BaseAdapter
I'm having some problems with my android project in eclipse. 我在eclipse中的android项目遇到了一些问题。
I have two XML layout files, and both contain ListViews. 我有两个XML布局文件,都包含ListViews。
The ListViews are working perfectly on my Android phone, but eclipse wont open the design window, giving the following error: ListViews在我的Android手机上完美运行,但是eclipse不会打开设计窗口,给出以下错误:
com.android.layoutlib.bridge.impl.binding.FakeAdapter cannot be cast to android.widget.BaseAdapter
Both files contains the following code: 这两个文件都包含以下代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/cardList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="true"
android:fastScrollAlwaysVisible="true"
android:fastScrollEnabled="true"
android:scrollbarSize="30dp"
android:scrollbarStyle="insideOverlay" >
</ListView>
</LinearLayout>
Any suggestions? 有什么建议么?
It might be the 它可能是
android:fastScrollAlwaysVisible="true"
that is bugging your application. 这会扰乱你的申请。 Try deleting it.
尝试删除它。
Just change device in layout preview. 只需在布局预览中更改设备。
Small screens (inches < 7) cannot preview properly. 小屏幕(英寸<7)无法正确预览。 Select 10.1'' for example.
例如,选择10.1''。
I don't have any android:fastScroll* option in any of my layouts, however I do receive this error on any version of Android, but can't reproduce on any test devices. 我的任何布局中都没有任何android:fastScroll *选项,但是我确实在任何版本的Android上都收到此错误,但无法在任何测试设备上重现。
Turns out this occurs when I attach an Adapter declared like this: 当我附加一个声明如下的适配器时,会发生这种情况:
MyAdapter implements ListAdapter
Changing to the following actually fixes the issue: 更改为以下内容实际上解决了问题:
MyAdapter extends BaseAdapter
EDIT: Turns out users where using an Xposed module to forst fastscroll on app ListView's! 编辑:结果使用Xposed模块的用户在应用ListView上快速滚动! Unfortunately that module is pretty dumb and doesn't check the adapter type.
不幸的是,该模块非常愚蠢,并且不检查适配器类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.