导入Activity时找不到ActionBarDrawerToggle

时间:2017-01-11 12:56:45

标签: android

当我导入AppCompatActivity ActionBarDrawerToggle工作正常但导入Activity时出错:

  

无法找到符号类ActionBarDrawerToggle

 //DrawerLayout
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

1 个答案:

答案 0 :(得分:0)

您需要在Gradle中添加支持库: (将25.1.0替换为您的sdk版本)

  

compile' com.android.support:design:25.1.0'