iNzzane iNzzane - 1 year ago 89
Android Question

Fragment placed on top of NavigationDrawer

I'm trying to add a

in my application. The problem is, it's auto placed on top of my

public class SetPreferenceActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
navigationDrawer(); // Loads the NavigationDrawer

new Settings()).commit();


As you can see I load the "SettingsFragment" and replace the content with it? (I'm unsure) but it places it on top of everything else.. Here's my Settings fragment.

public class Settings extends PreferenceFragment {
static final String TAG = "MAIN";

public void onCreate(Bundle savedInstanceState){


Everything work as expected, BUT the PreferenceFragment are loaded in front, covering up the NavigationDrawer slideout, I tried calling
on the listview, with no luck.

A picture for reference :

Is it possible to tell the fragment to load behind the listview? I also tought about loading the fragment in a ViewPager, but I get an error that the Pager Adapter wont accept fragments of type PreferenceFragment.

Answer Source

Don't replace, use the the id of the FrameLayout you have in the layout that contains your DrawerLayout.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download