从fragment获取ActionBarDrawerToggle

时间:2015-02-07 16:16:57

标签: java android android-fragments android-actionbar navigation-drawer

我有一个带有吸引力的MainActivity.java和它的听众

toggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close){
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            super.onDrawerSlide(drawerView, slideOffset);
        }

        /** Called when a drawer has settled in a completely closed state. */
        @Override
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            FloatingButton.getInstance(context).showFloatingActionButton();
        }

        /** Called when a drawer has settled in a completely open state. */
        @Override
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            FloatingButton.getInstance(context).hideFloatingActionButton();
        }
    };

我只能从MainActivity

访问它

而且我还有10个片段。我需要从每个片段访问此侦听器。

任何想法如何? Thx提前!

0 个答案:

没有答案