I am designing custom navigation drawer like image shown below.I am using navigation drawer provided by the android studio but I need to change like this.How can I do this?

- 177
- 1
- 10
-
check out this repo https://github.com/PHELAT/CustomNavigationDrawer – Mahdi Nouri Apr 28 '17 at 13:45
-
You can try [this](http://stackoverflow.com/a/23632492/7413139) this is example is more efficient – vaibhav Apr 28 '17 at 14:09
3 Answers
If your talking about the magnification lense I think you would want to use something that captures the view as a bitmap and then crops and scales the bitmap. An example to covert a view could be this
public static Bitmap getBitmapFromView(View v) {
Bitmap returnedBitmap = Bitmap.createBitmap(v.getWidth(),
v.getHeight(),Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(returnedBitmap);
v.layout(0, 0, v.getLayoutParams().width,
v.getLayoutParams().height);
v.draw(canvas);
return returnedBitmap;
}
Then you would want to apply the bitmap to a canvas and then scale, crop and draw pond the canvas to get the desired look.
If you were just talking about the background then you would have to make a custom list view which there are plenty of tutorials already on Here's a good link: http://www.journaldev.com/10416/android-listview-with-custom-adapter-example-tutorial

- 303
- 3
- 8
You need to make your navigation drawer with help of a listView or RecyclerView and creating a customAdapter for it. You can get help from this link

- 1,356
- 1
- 14
- 31
-
I had gone through the some of tutorials which are based on the RecyclerView but list is not continue it for first it contains 2 items like general,security and for second it contains 6 items like timeline,sound,location – Rohan Chavan Apr 28 '17 at 13:44
-
You can use different views instead of using a listView then, just take a LinearLayout and make similar type of view yourself and use it as your navigation drawer. – Anmol317 Apr 28 '17 at 14:01
i have much more Simpler way which wont cost you trouble.Take a look.This function should be under onCreate functions.
NavigationView rightNavigationView = (NavigationView) findViewById(R.id.nav_right_view);
rightNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle Right navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_settings) {
Toast.makeText(Home.this, "Right Drawer - Settings", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_logout) {
Toast.makeText(Home.this, "Right Drawer - Logout", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_help) {
Toast.makeText(Home.this, "Right Drawer - Help", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_about) {
Toast.makeText(Home.this, "Right Drawer - About", Toast.LENGTH_SHORT).show();
}
drawer.closeDrawer(GravityCompat.END); /*Important Line*/
return true;
}
});
Now go to youe menu folder and create an xml file in which you can decide the looks of your Drawer layout

- 122
- 2
- 9