Open hylarucoder opened 9 years ago
you can try this : GlobalMenuView.setOnItemClickListener....
Oh ,Thank You.
@BaseActivity private void setupDrawer() { DrawerMenuView menuView = new DrawerMenuView(this); menuView.setOnHeaderClickListener(this); drawerLayout = DrawerLayoutInstaller.from(this) .drawerRoot(R.layout.drawer_root) .drawerLeftView(menuView) .drawerLeftWidth(Utils.dpToPx(300)) .withNavigationIconToggler(getToolbar()) .build(); menuView.setOnItemClickListener(new DrawerItemClickListener()); } private class DrawerItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { int mPosition = (position - 1); selectedItem(mPosition); drawerLayout.closeDrawer(Gravity.START); } }
protected void selectedItem(int selectedItem){}
@MainActivity @Override protected void selectedItem(int selectedItem) { Toast.makeText(MainActivity.this, "Position = "+selectedItem, 1).show(); }
You code well!
And i have a very simple question to ask you.
app/src/main/java/io/github/froger/instamaterial/ui/adapter/GlobalMenuAdapter.java
you set the drawer items , but how can i add a click event?