XML形成不良Android不断出现

时间:2012-08-20 10:03:48

标签: android xml well-formed

我在一个应用程序中有一个XML文件,我刚下载了它,eclipse一直告诉我它没有很好地形成。我看不出语法的任何问题(我甚至用xml验证器w3schools检查了它,它也找不到任何错误。

非常感谢您提前,这是文件:

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->

<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/dock_settings_title"
android:key="parent">


<!-- 
<PreferenceScreen
    android:key="dock_audio"
    android:title="@string/dock_audio_settings_title"
    android:summary="@string/dock_settings_summary"
   android:widgetLayout="@*android:layout /preference_dialog" />


<CheckBoxPreference
    android:key="dock_sounds"
    android:title="@string/dock_sounds_enable_title"
    android:summaryOn="@string/dock_sounds_enable_summary_on"
    android:summaryOff="@string/dock_sounds_enable_summary_off"
    android:defaultValue="false" />
    -->

</PreferenceScreen>

1 个答案:

答案 0 :(得分:0)

在您的评论代码中PreferenceScreenCheckBoxPreference之前关闭

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
        <PreferenceCategory
                android:title="First Category">
                <CheckBoxPreference
                        android:title="Checkbox Preference"
                        android:defaultValue="false"
                        android:summary="This preference can be true or false"
                        android:key="checkboxPref" />
                <ListPreference
                        android:title="List Preference"
                        android:summary="This preference allows to select an item in a array"
                        android:key="listPref"
                        android:defaultValue="digiGreen"
                        android:entries="@array/listArray"
                        android:entryValues="@array/listValues" />
        </PreferenceCategory>

</PreferenceScreen>

看看这个链接。 http://www.kaloer.com/android-preferences