[英]Cannot open XML files in Graphical Layout: FakeAdapter cannot be cast to BaseAdapter
我在eclipse中的android项目遇到了一些问题。
我有两个XML布局文件,都包含ListViews。
ListViews在我的Android手机上完美运行,但是eclipse不会打开设计窗口,给出以下错误:
com.android.layoutlib.bridge.impl.binding.FakeAdapter cannot be cast to android.widget.BaseAdapter
这两个文件都包含以下代码:
<?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>
有什么建议么?
它可能是
android:fastScrollAlwaysVisible="true"
这会扰乱你的申请。 尝试删除它。
只需在布局预览中更改设备。
小屏幕(英寸<7)无法正确预览。 例如,选择10.1''。
我的任何布局中都没有任何android:fastScroll *选项,但是我确实在任何版本的Android上都收到此错误,但无法在任何测试设备上重现。
当我附加一个声明如下的适配器时,会发生这种情况:
MyAdapter implements ListAdapter
更改为以下内容实际上解决了问题:
MyAdapter extends BaseAdapter
编辑:结果使用Xposed模块的用户在应用ListView上快速滚动! 不幸的是,该模块非常愚蠢,并且不检查适配器类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.