我在 oncreate 函数中使用此代码通过按应用程序图标打开导航抽屉。
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(
this, /* host Activity */
(DrawerLayout) findViewById(R.id.left_drawer), /* DrawerLayout object */
getResources().getDrawable(R.drawable.ic_drawer), /* nav drawer icon to replace 'Up' caret */
getString(R.string.drawer_open), /* "open drawer" description */
getString(R.string.drawer_close) /* "close drawer" description */
) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
getActionBar().setTitle(R.string.title_activity_add);
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(R.string.drawer_title);
}
};
现在它说“构造函数 ActionBarDrawerToggle(AddActivity, DrawerLayout, Drawable, String, String) 未定义”。我已经导入了 android.support.v4.app.ActionBarDrawerToggle。问题出在哪里?