2015-04-01 51 views
1

这里是我的preferences.xml文件的代码:Android Studio中呈现的问题:首

<?xml version="1.0" encoding="utf-8"?> 
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent"> 
    <CheckBoxPreference 
     android:key = "test" 
     android:title = "Test" 
     android:summary = "Yes It WORKED" 
     android:defaultValue="true" 
     /> 

</PreferenceScreen> 

机器人工作室渲染器给了我以下错误信息:

The following classes could not be found: 
    -CheckBoxPreference(Fix build path) 
    -PreferenceScreen(Fix build path) 

此外,它给我的错误时,我没有投入:

android:layout_height="match_parent" 
android:layout_width="match_parent"> 

虽然Google本身(http://developer.android.com/guide/topics/ui/settings.html)不说了关于这个的话。 (当运行代码时,它们显示一个操作栏,我只能看到屏幕最上方的复选框偏好)

回答

3

在res中创建一个xml文件夹,并在其中移动.xml文件(例如:preferences.xml)。

enter image description here