0

我刚刚下载的应用程序中有一个 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>
4

1 回答 1

0

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

<?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

于 2012-08-20T10:09:37.193 回答