This one took me a while, but I was able to make this work for my app. I don't know if it makes a difference, but I am using HoloEverywhere
, so I only assume this will work on the standard PreferenceActivity
as well.
In my PreferenceActivity
when I overrode all versions of setContentView()
to load my custom DrawerLayout
which is like yours and has a ListView
with the standard android id of list
. In the last method I made sure to call onContentChanged()
after I called super.setContentView()
:
@Override
public void setContentView(int layoutResID)
{
setContentView( getLayoutInflater().inflate( layoutResID ) );
}
@Override
public void setContentView(View view)
{
setContentView( view, new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT ) );
}
@Override
public void setContentView(View view, LayoutParams params)
{
// inflate the drawer layout
super.setContentView( R.layout.navigation_drawer_base_layout );
DrawerLayout dl = findViewById(R.id.drawer_layout);
// do stuff here initialize the DrawerLayout like add a DrawerToggle, etc
...STUFF
// Call onContentsChanged() to let the Activity know it needs to refresh itself.
onContentChanged();
}
In onBuildHeaders()
I still call loadHeadersFromResource()
to create all the Header
s for my different PreferenceScreen
s.