kir*_*hra 5 android slidingmenu jfeinstein
我正在使用jfeinstein10 的漂亮图书馆
但是在打开和关闭菜单时它第一次被卡住了,然后它就可以正常工作了。如果仅使用关闭菜单列表从菜单中选择相同的菜单,我就不会刷新片段
getSlidingMenu().toggle();
如果有人有同样的问题,如果你有解决方案,请告诉我。
在你的活动中试试这个:-
@Override
public boolean onOptionsItemSelected(
MenuItem item) {
// The action bar home/up action should open or close the drawer.
// ActionBarDrawerToggle will take care of this.
/*
* if (mDrawerToggle.onOptionsItemSelected((MenuItem) item)) { return
* true; }
*/
// Handle action buttons
switch (item.getItemId()) {
case android.R.id.home:
if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
mDrawerLayout.closeDrawer(mDrawerList);
} else {
mDrawerLayout.openDrawer(mDrawerList);
}
return true;
break;
default:
return true;
}
return super.onOptionsItemSelected(item);
}
/* The click listner for ListView in the navigation drawer */
private class DrawerItemClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
if (position == 1) {
mDrawerLayout.closeDrawer(mDrawerList);
} else if (position == 2) {
mDrawerLayout.closeDrawer(mDrawerList);
}
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass any configuration change to the drawer toggls
mDrawerToggle.onConfigurationChanged(newConfig);
}
Run Code Online (Sandbox Code Playgroud)
欲了解更多信息,请单击此处 这里是演示代码,可以帮助您...
| 归档时间: |
|
| 查看次数: |
801 次 |
| 最近记录: |