在这里,我想知道在切换片段时如何制作平滑的导航抽屉。我使用工具栏使用自定义导航抽屉,每当我切换几个片段时,它会卡在几个有Map等的片段中,但它在我只有文本视图的地方顺利工作。有人可以帮我解决一下吗?
/**
* Diplaying fragment view for selected nav drawer list item
*/
public int displayView(int position, int position2, int position3) {
// update the main content by replacing fragments
Fragment fragment = null;
switch (position) {
case 0:
sharedPreferences = getSharedPreferences("sharePref", 0);
cb = sharedPreferences.getBoolean("ConfirmLogin", false);
if (cb) {
} else
fragment = new LoginActivity();
break;
case 3:
fragment = new MainTabFragment();
break;
case 4:
fragment = new ContactUs();
break;
default:
break;
}
if (fragment != null) {
mDrawerLayout.closeDrawer(mDrawerList);
FragmentManager fragmentManager = getSupportFragmentManager();
final Bundle bundle = new Bundle();
bundle.putInt("pos_next", position2);
bundle.putInt("pos_end", position3);
fragment.setArguments(bundle);
fragmentManager.beginTransaction().replace(com.cws.advisorymandi.R.id.frame_container, fragment).commit();
// update selected item and title, then close the drawer
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
// setTitle(navMenuTitles[position]);
} else {
// error in creating fragment
Log.e("MainActivity", "Error in creating fragment");
}
return 0;
}
答案 0 :(得分:0)
滚动地图视图会干扰寻呼机的滚动。我认为你需要通过使用来控制滚动 http://developer.android.com/reference/android/support/v4/view/ViewPager.html#canScroll(android.view.View,boolean,int,int,int)
这将通知寻呼机何时可以滚动以及何时无法