首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到PreferenceScreen类

找不到PreferenceScreen类
EN

Stack Overflow用户
提问于 2012-07-18 10:51:58
回答 1查看 5.5K关注 0票数 3

我有一个简单的preferences.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
        <PreferenceCategory
                android:title="First Category">
                <CheckBoxPreference
....

我的安卓版本是2.1 (API7) java是1.6,使用eclipse。在package中,有android.jar,在我打开它之后,就有了android.preference包。

即使如此,我还是会得到以下错误:

代码语言:javascript
复制
com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- PreferenceCategory (Fix Build Path, Edit XML)
- PreferenceScreen (Fix Build Path, Edit XML)

我该怎么办?事先鸣谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-18 11:09:55

如果preferences.xml不在res/xml中,则应该将其移到那里。我猜这可能是你问题的根源。

票数 19
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11539692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档