I got the following code from the android documentation
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:key="pref_sync"
android:title="@string/pref_sync"
android:summary="@string/pref_sync_summ"
android:defaultValue="true" />
<ListPreference
android:dependency="pref_sync"
android:key="pref_syncConnectionType"
android:title="@string/pref_syncConnectionType"
android:dialogTitle="@string/pref_syncConnectionType"
android:entries="@array/pref_syncConnectionTypes_entries"
android:entryValues="@array/pref_syncConnectionTypes_values"
android:defaultValue="@string/pref_syncConnectionTypes_default" />
</PreferenceScreen>
Android studio is giving me an error saying I am missing Height and Width on the PreferenceScreen
tag. It's easy enough to fix but I can't believe the doc would have invalid code so I am curious if I am doing something wrong and I am missing a setting somewhere.
Probably a studio bug recognizing PreferenceScreen as layouts if you misplaced it in res/layout/ folder.
Your preference xml should be res/xml/ folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With