How do i change the color of the action bar toggle?
Here is my code for my action bar in java:
//Navigation view and Drawer layout
drawerlayout = (DrawerLayout) findViewById(R.id.main_ND);
actionBarDrawerToggle = new ActionBarDrawerToggle(this,drawerlayout,0,0);
navigationView = (NavigationView) findViewById(R.id.main_NV);
navigationView.setItemIconTintList(null);
View headerView = navigationView.getHeaderView(0);
nD_image = (ImageView) headerView.findViewById(R.id.nd_image);
Glide.with(getBaseContext()).load(R.drawable.my_paper).centerCrop().into(nD_image);
setNavigationView();
drawerlayout.addDrawerListener(actionBarDrawerToggle);
actionBarDrawerToggle.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
if(actionBarDrawerToggle.onOptionsItemSelected(item))
{
return true;
}
return super.onOptionsItemSelected(item);
}
In my styles
<style name="my_theme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimaryDark">@color/salmonDark</item>
<item name="colorPrimary">@color/salmon_main</item>
<item name="colorAccent">@color/black</item>
<item name="android:actionMenuTextColor">@color/white</item><!-- green was: #8BC34A -->
<item name="android:actionMenuTextAppearance">@style/actionBarTextSize</item>
</style>
And then in my manifest
<activity android:name=".Main.Main"
android:screenOrientation="portrait"
android:theme="@style/zivit_theme"/>
Im quite not sure how to change the color or where to do it. I hope someone can post some example code of the step by step process in (or that magic one line of code that does it) thank you!
try this:
in base theme: add an item for the action bar
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
custom action bar theme:
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">@style/MyTitleTextStyle</item>
<item name="android:background">@color/background</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">@style/TitleTextStyle</item>
<item name="background">@color/background</item>
</style>
you can also modify action bar text color:
<style name="MyTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/foreground</item>
</style>
Toggle button style:
<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">@color/foreground</item>
</style>