Я хочу установить пользовательскую кнопку гамбургера ( ic_navigation_drawer ) на панели действий:
Моя пользовательская тема:
<!-- Base application theme. -->
<style name="MainAppBaseTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/DefaultActionBar</item>
</style>
<style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/DefaultActionBar</item>
</style>
<!-- Default actionBar styles -->
<style name="DefaultActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/colorPrimary</item>
<item name="android:titleTextStyle">@style/DefaultActionBar.TitleTextStyle</item>
</style>
в manifest.xml
<application
android:name=".main.MainApp"
android:allowBackup="true"
android:icon="@drawable/ic_app"
android:label="@string/application_name"
android:logo="@drawable/ic_app_logo"
android:theme="@style/MainAppBaseTheme">
В моем androidx.fragment.app.FragmentActivity:
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
getActionBar().setHomeAsUpIndicator(R.drawable.ic_navigation_drawer);
mToolbar = (Toolbar) findViewById(R.id.toolBar);
actionBarDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
mToolbar, R.string.application_name,
R.string.application_name) {
public void onDrawerClosed(View view) {
mToolbar.setTitle(mTitle);
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
mToolbar.setTitle(mDrawerTitle);
invalidateOptionsMenu();
loadDraftsTotalNumber();
loadActiveCart();
}
};
mDrawerLayout.setDrawerListener(actionBarDrawerToggle);
@Override
protected void onPostCreate(Bundle savedInstanceState) {
if (BuildConfig.DEBUG)
Log.d(TAG, "onPostCreate");
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
actionBarDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass any configuration change to the drawer toggles
actionBarDrawerToggle.onConfigurationChanged(newConfig);
}
и вот результат
- Когда ящик навигации закрыт:
![enter image description here](https://i.stack.imgur.com/dhv0y.png)
- Когда ящик навигации открыт:
![enter image description here](https://i.stack.imgur.com/yarf8.png)
Как видите, кнопка навигации (гамбургер) не изменилась. Также не анимируется при открытии / закрытии навигационного ящика
почему