要在androidx.appcompat.app.ActionBarDrawerToggle中显示汉堡按钮,可以按照以下步骤进行操作:
android.useAndroidX=true
android.enableJetifier=true
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawerLayout = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawerLayout.addDrawerListener(toggle);
toggle.syncState();
public class MainActivity extends AppCompatActivity {
//...
}
通过以上步骤,你应该能够在androidx.appcompat.app.ActionBarDrawerToggle中显示汉堡按钮。