Navigation drawer in android is not full screen

user782104 picture user782104 · Nov 25, 2013 · Viewed 18.4k times · Source

Since the google has introduced the navigation drawer, I tried to use this component to create a facebook-like menu. The problem is , the visual effect is seems to be different.

The google one has the action bar retain when the drawer is open while the facebook one does not.Instead, the whole screen has pushed to right side

I have found there are some lib can achieve this, but since I prefer not include third party lib in the project, are there any way to achieve this ? Thanks

Google:

Facebook:

Code based on navigation drawer tutorial

protected void setupMenu(List<String> list, final ListView menu) {
        Adapter customAdapter = new Adapter(getActionBar().getThemedContext(),
                R.layout.item, list);
        menu.setAdapter(customAdapter);
        menu.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    final int pos, long id) {
                String selected = ((TextView) view.findViewById(R.id.itemTxt))
                        .getText().toString();
                // define pass data
                final Bundle bData = new Bundle();
                bData.putString("itemSelect", selected);

                drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
                    @Override
                    public void onDrawerClosed(View drawerView) {
                        super.onDrawerClosed(drawerView);
                        FragmentTransaction tx = getSupportFragmentManager()
                                .beginTransaction();
                        tx.replace(R.id.mainContent, Fragment.instantiate(
                                MainActivity.this,
                                "com.example.utilities.ContentPage", bData));
                        tx.commit();
                    }
                });

                drawer.closeDrawer(menu);
            }
        });

    }

Answer

aNoviceGuy picture aNoviceGuy · Nov 25, 2013

Well creating a custom navigation drawer is the best solution for you. I understand you do not want to use third party but this can be a quick solution to your problem Sliding Menu Lib link.