I am writing an Android app to take advantage of Drawer Layout functionality. I want to have an ability to use Drawer Layout as a navigational tool available throughout the app. To use the Drawer Layout, I am using the following in my activity layout xml files:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<LinearLayout
android:id="@+id/main_content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView android:id="@+id/navigational_drawer"
android:layout_width="220dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#FFFFFF"/>
</android.support.v4.widget.DrawerLayout>
However, I am having a lot of difficulties wrapping DrawerLayout around the PreferenceActivity. PreferenceActivity is a special sort of activity that I'd like to preserve because it helps me to maintain the look and feel of the Android preferences in my app; that being said, it uses addPreferencesFromResource() calls to load preferences and does not use addContentView() calls to load XML files; the preference resources typically contain PreferenceScreen tags that don't like to be wrapped in DrawerLayouts.
Anybody had to deal with that issue and how did you solve it? If you have PreferenceActivity in your Android app and you have DrawerLayout available on the same activity, please share how did you do it. Any help would be much appreciated.
EDITED: If I change
<!-- The main content view -->
<LinearLayout
android:id="@+id/main_content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
to
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
then the app doesn't crash when PreferenceActivity is loaded (because the id "list" matches what the Preference Activity is expecting to find); however, the Drawer is not showing. It's almost as if everything below the ListView "list" is getting ignored.