-
-
Save hossinasaadi/6acc15d34fd06e58121899944ccb2d17 to your computer and use it in GitHub Desktop.
How to change toolbar back arrow color and title color?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From theme | |
<style name="SearchToolbar" parent="Theme.AppCompat.Light.NoActionBar"> | |
//toolbar back arrow color | |
<item name="android:textColorSecondary">@android:color/white</item> | |
//toolbar title color | |
<item name="android:textColorPrimary">@android:color/white</item> | |
</style> | |
Also we can do it from java code: | |
private void setupToolbar() { | |
//for crate home button | |
AppCompatActivity activity = (AppCompatActivity) getActivity(); | |
activity.setSupportActionBar(mToolbar); | |
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
final Drawable upArrow = ContextCompat.getDrawable(getActivity(), R.drawable.abc_ic_ab_back_material); | |
upArrow.setColorFilter(ContextCompat.getColor(getActivity(), R.color.white), PorterDuff.Mode.SRC_ATOP); | |
activity.getSupportActionBar().setHomeAsUpIndicator(upArrow); | |
mToolbar.setNavigationOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
dismiss(); | |
} | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment