Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation drawer in android is not full screen

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);
            }
        });

    }
like image 508
user782104 Avatar asked Nov 25 '13 10:11

user782104


1 Answers

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.

like image 154
aNoviceGuy Avatar answered Sep 28 '22 00:09

aNoviceGuy