Minimum SDK version that I'm supporting is 14. I have Action bar in my application and everything about it's functionality is okay.
My only problem is up or back caret which is gray color. I want to have it white color. Therefore, I designed similar caret with white color in different sizes. so my question is how to replace gray/default caret with mine?
So what I did? Based on what this guy said, I added
<item name="android:homeAsUpIndicator">@drawable/ic_drawer_back</item>
into my app theme like this:
<style name="Theme.Example" parent="@android:style/Theme.Holo.Light">
...
<item name="android:actionBarStyle">@style/ActionBar.Solid.Example</item>
</style>
<style name="ActionBar.Solid.Example" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
...
<item name="android:homeAsUpIndicator">@drawable/ic_drawer_back</item>
</style>
Although I'm telling ic_drawer_back
image should be loaded as caret but when I run the app default(gray) caret is still displaying.
Did you face this problem before? any suggestion would be appreciated. Thanks
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
){
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
// calling onPrepareOptionsMenu() to show action bar icons
invalidateOptionsMenu();
// display view for selected nav drawer item
displayView(selectedDrawerItem);
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
// calling onPrepareOptionsMenu() to hide action bar icons
invalidateOptionsMenu();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// if nav drawer is opened, hide the action items
// boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
// menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
return super.onPrepareOptionsMenu(menu);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass any configuration change to the drawer toggles
mDrawerToggle.onConfigurationChanged(newConfig);
}