I connected a custom font to the MainActivity
Typeface typeface = Typeface.createFromAsset(getAssets(), "BeeskneesC.otf"); How can I change the ActionBar font style to custom?
I connected a custom font to the MainActivity
Typeface typeface = Typeface.createFromAsset(getAssets(), "BeeskneesC.otf"); How can I change the ActionBar font style to custom?
You can either in this way
int titleId = getResources().getIdentifier("action_bar_title", "id", "android"); TextView textView = (TextView) findViewById(titleId); textView.setTextColor(getResources().getColor(R.color.black)); textView.setTypeface(face); either in this way
SpannableString s = new SpannableString("My Title"); s.setSpan(new TypefaceSpan(this, "MyTypeface.otf"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(s); Source: https://ru.stackoverflow.com/questions/621534/
All Articles