小编cta*_*lor的帖子

切换到GUI xml时出现Eclipse Android错误

当我从xml切换到GUI以获取首选项布局文件时,出现以下错误:

渲染期间引发异常:com.android.layoutlib.bridge.MockView无法强制转换为android.view.ViewGroup窗口>显示视图>错误日志中记录异常详细信息无法找到以下类: - PreferenceCategory(修复构建路径,编辑XML) - PreferenceScreen(修复构建路径,编辑XML)

我的xml文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<PreferenceScreen 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

  <PreferenceCategory
    android:title="Activation">
    <CheckBoxPreference
      android:title="Title1"
      android:defaultValue="false"
      android:key="checkbox1">
    </CheckBoxPreference>
  </PreferenceCategory>

  <PreferenceCategory
    android:title="Option1">
    <PreferenceScreen
        android:title="Set Option">
    <CheckBoxPreference
      android:title="ENABLE OPTION"
      android:defaultValue="false"
      android:summary="text"
      android:key="checkboxOption1">
    </CheckBoxPreference>
    <CheckBoxPreference
      android:title="DISPLAY OPTIONS"
      android:defaultValue="false"
      android:summary="text"
      android:key="checkboxDisplay1">
    </CheckBoxPreference>
    <EditTextPreference
      android:title="OPTION2"
      android:name="Option2"
      android:summary="text"
      android:defaultValue="1"
      android:key="editOption2">
    </EditTextPreference>
    <CheckBoxPreference
      android:title="OPTION3"
      android:defaultValue="false"
      android:summary="text"
      android:key="checkboxOption3">
    </CheckBoxPreference>
    </PreferenceScreen>
  </PreferenceCategory>

  <PreferenceCategory
    android:title="Option4">
    <PreferenceScreen
        android:title="Set Option4">
    <CheckBoxPreference
      android:title="OPTION4"
      android:defaultValue="false"
      android:summary=""
      android:key="checkboxOption4">
    </CheckBoxPreference>
    <CheckBoxPreference
      android:title="OPTION5"
      android:defaultValue="false"
      android:summary="text"
      android:key="checkboxOption5">
    </CheckBoxPreference>
    <EditTextPreference
      android:title="OPTION6"
      android:name="Option6"
      android:summary="text"
      android:defaultValue="1"
      android:key="editOption6">
    </EditTextPreference> …
Run Code Online (Sandbox Code Playgroud)

android-layout

5
推荐指数
1
解决办法
4825
查看次数

标签 统计

android-layout ×1