zoukankan      html  css  js  c++  java
  • SlideMenu例子解析2

    使用SlideMenu+ViewPager时的问题

    两个都是和手势有关的,到底会怎么反应呢

    测试了下。貌似是SlideMenu的手势优先啊,也就是说,把页面滑过去了,就不能回了。

    下面的代码很好的解决了该问题

    1                 switch (position) {
    2                 case 0:
    3                     getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); //在最开头的页面可以全屏手势控制菜单
    4                     break;
    5                 default:
    6                     getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); //其他地方的页面只有边边上可以控制菜单
    7                     break;
    8                 }
    9             

    FragmentChangeActivity 使用菜单上的每个项来控制在主内容区的变化

    FragmentChangeActivity:

    public void onSaveInstanceState(Bundle outState) {
            super.onSaveInstanceState(outState);
            getSupportFragmentManager().putFragment(outState, "mContent", mContent);
        }
        
        public void switchContent(Fragment fragment) {
            mContent = fragment;
            getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.content_frame, fragment)
            .commit();
            getSlidingMenu().showContent();
        }

    ColorMenuFragment:

     1     // the meat of switching the above fragment
     2     private void switchFragment(Fragment fragment) {
     3         if (getActivity() == null)
     4             return;
     5         
     6         if (getActivity() instanceof FragmentChangeActivity) {
     7             FragmentChangeActivity fca = (FragmentChangeActivity) getActivity();
     8             fca.switchContent(fragment);
     9         } else if (getActivity() instanceof ResponsiveUIActivity) {
    10             ResponsiveUIActivity ra = (ResponsiveUIActivity) getActivity();
    11             ra.switchContent(fragment);
    12         }
    13     }
  • 相关阅读:
    关于VS中更改栈和堆空间的大小
    BS模式的模型结构详解
    友情链接
    [ThinkPHP] 比较标签 neq&nheq 与 PHP 中的 != 与 !== 出现的问题
    [个人思考] 裸泳的问题
    [label][Chrome-Extension] How to start Chrome Extension's development
    [label][OS] 制作 U 盘安装 Windows 7
    [label][Google-Developers] Your First Multi Screen Site
    Min Stack
    Implement Stack using Queues
  • 原文地址:https://www.cnblogs.com/act262/p/3579308.html
Copyright © 2011-2022 走看看