Customizing the labels of an ActionBar

In the post Tab Layout in Android with ActionBar and Fragment I wrote an example of using an ActionBar whose labels are shown in uppercase even if you use the statement:
actionBar.newTab (). setText (“my string”);
where “my string” is lowercase.
In this article I show how to customize the labels in lowercase but it is evident that you can customize many other aspects.
I assume you have already created the project in Tab Layout in Android with ActionBar and Fragment as starting point.

  1. create the files res/layout/tablabel1.xml and res/layout/tablabel2.xml


    these files are derived from the file tab_inidcator.xml of the source code of Android
  2. modify the method onCreate of the class eu.lucazanini.TabActionBarActivity with the following:

    this method need the import android.widget.RelativeLayout
  3. launch the application:

7 Replies to “Customizing the labels of an ActionBar”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.