I am developing app with minSdkVersion=\"11\", that is app for tablets and Android 4.0 and newer. I have scrutinized internet on this topic, but have not found much.
To
you do not need to setContenView. in this example case the layout population is done via headers and associated fragments, another words automatically.
i tried this code for my application
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/PreferencesActivity.GeneralSettingsCategoryTitle">
<Preference
android:title="yor title"
android:summary="your summary"
android:key="key to access preference" />
<Preference
android:title="@string/"
android:summary="@string/"
android:key="key2" />
<PreferenceScreen
android:key="key3"
android:title="@string/"
android:summary="@string/">
<CheckBoxPreference
android:title="@string/"
android:defaultValue="false"
android:summary="@string/"
android:key="key4" />
<CheckBoxPreference
android:title="@string/"
android:defaultValue="true"
android:summary="@string/"
android:key="key5" />
<ListPreference
android:title="@string/"
android:summary="@string/"
android:key="key6"
android:defaultValue="buttons"
android:entries="@array/"
android:entryValues="@array/" />
....
</prefefenceScreen>
</preferenceCategory>
</preferenceScreen>
enter code here
I had the same issue than you.
I tried a lot of stuff but here is my full code:
https://github.com/iRail/BeTrains-for-Android/blob/master/src/tof/cv/mpp/MyPreferenceActivity.java
The trick is to add the setContentView in the onBuildHeaders section, but NOT in the onCreate.
I also made some tests in fragment and not perfectly sure why this is working, but I promise you: I have a custom layout on tablet header section!
https://github.com/iRail/BeTrains-for-Android/blob/master/src/tof/cv/mpp/view/StockPreferenceFragment.java