ActionBarDrawerToggle想要Activity DrawerLayout Int Int Int

时间:2015-06-19 17:04:51

标签: android

我正在玩我的新应用中的抽屉,当我设置我的抽屉时,我正在使用代码

mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close, 0) {

         /** Called when a drawer has settled in a completely open state. */
         public void onDrawerOpened(View drawerView) {
             super.onDrawerOpened(drawerView);

         }

         /** Called when a drawer has settled in a completely closed state. */
         public void onDrawerClosed(View view) {
             super.onDrawerClosed(view);

         }
     };
     mDrawerToggle.setDrawerIndicatorEnabled(true);
     mDrawerLayout.setDrawerListener(mDrawerToggle);

然而,eclipse一直在抱怨ActionBarDrawerToggle想要MainActivity, DrawerLayout, Int, Int, Int,尽管我已经看到其他Stack问题,例如thisthis,但我按照我的方式使用它并跟随他们修复,我仍然得到同样的错误。

有什么想法吗?

添加此活动也使用googlemap,不确定这是否会产生任何影响

1 个答案:

答案 0 :(得分:0)

从v7支持库导入ActionBarDrawerToggle,而不是v4支持库

import android.support.v7.app.ActionBarDrawerToggle;

删除此

 import android.support.v4.app.ActionBarDrawerToggle;