2015-04-01 82 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