0

我的应用中有一个不是启动器的活动。我想添加一个带切换器的导航抽屉。我尝试按照此处的说明进行操作http://developer.android.com/training/implementing-navigation/nav-drawer.html#ActionBarIcon

但是我的后退导航仍然显示(它退出了应用程序,因为我已向意图添加了适当的标志)如何显示抽屉切换器图标?

android.support.v4.app.ActionBarDrawerToggler 也已弃用,我应该改用什么?

4

1 回答 1

0

对于 android.support.v4.app.ActionBarDrawerToggler 已弃用以使用新的获取支持库 supporv7 appcompact 在此处查看https://developer.android.com/intl/es/reference/android/support/v4/app/ActionBarDrawerToggle.html

并在此处创建导航抽屉,您将获得所有信息 http://developer.android.com/intl/es/training/implementing-navigation/nav-drawer.html

代码示例

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();

使用最新的支持库,您将轻松完成它,而不是使用 setHomeasUpEnabled(true)

于 2015-10-20T16:07:07.070 回答