Java 无法在图形布局中打开XML文件:FakeAdapter无法转换为BaseAdapter
我在eclipse中的android项目有一些问题 我有两个XML布局文件,都包含ListView ListView在我的Android手机上运行良好,但eclipse无法打开设计窗口,出现以下错误:Java 无法在图形布局中打开XML文件:FakeAdapter无法转换为BaseAdapter,java,android,eclipse,Java,Android,Eclipse,我在eclipse中的android项目有一些问题 我有两个XML布局文件,都包含ListView ListView在我的Android手机上运行良好,但eclipse无法打开设计窗口,出现以下错误: com.android.layoutlib.bridge.impl.binding.FakeAdapter cannot be cast to android.widget.BaseAdapter 两个文件都包含以下代码: <?xml version="1.0" encoding="utf
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
编辑:在应用程序ListView上使用Xposed模块进行快速滚动的用户!不幸的是,该模块相当愚蠢,没有检查适配器类型。这似乎是Eclipse的ADT插件中的一个错误。确保您使用的是当前版本的ADT和SDK开发工具。删除
android:fastScrollEnabled=“true”
和android:fastScrollEnabled=“true”
这背后的原因是什么?你能解释一下吗?我不能,不。这是我通过反复试验才弄明白的事情之一。