Click here to Skip to main content
12,353,329 members (71,208 online)
Click here to Skip to main content
Add your own
alternative version

Stats

6.3K views
4 bookmarked
Posted

Change an Android Layout's default header text

, 16 May 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
How to quickly and easily change a Layout's header text

I Don't Know What to Call This Guy...

When you create an Activity/Layout pair, the default text defining the Layout (the name of the Activity) will display to the right of the cute little green Android with the transparent belly who seems to have swallowed a di[c]e which has had the dye inside its debossed divits worn away by robot stomach acid (or is that simply an upside-down peace sign?)*:

* There must be an official moniker for the glyph of that cute li'l feller, but I obviously don't know what it is.

It could be that the text shown is something that is not human-friendly, such as "DeliveryItemActivity".

...But Changing the Text is as Easy as Pie

If so, and you want it to be something else, perhaps just inserting spaces between the words (such as "Delivery Item Activity"), or even change it to something totally different, here is how you do that:

Open the strings.xml file (beneath [projectName]\app\src\main\res\values) and locate the string value that you want to replace. In the example given, it is:

<string name="title_activity_delivery_item">DeliveryItemActivity</string>

Now change it to:

<string name="title_activity_delivery_item">New Delivery</string>

..and voila! The Layout now bears that new text description to your right/the left of your little green buddy:

Of course, the text you use is up to you - you could make it "Zombies: Time of the Season, She's Not There, Tell Her No" if you wanted to.

Hopefully, that great and vastly underappreciated band will get back together and release an album entitled "Apocalypse"!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

B. Clay Shannon
Founder "Across Time & Space"
United States United States
Ideaman and Coder at Across Time & Space, creator of "Mark Twain Central" at http://twaincentral.azurewebsites.net/

Peripatetic and picaresque, I have lived in eight states; specifically, besides my native California (where I was born and where I now again reside) in chronological order: New York, Montana, Alaska, Oklahoma, Wisconsin, Idaho, and Missouri.

I am also a writer of both fiction (for which I use a nom de plume, "Blackbird Crow Raven", as a nod to my Native American heritage - I am "½ Cowboy, ½ Indian") and nonfiction: http://www.lulu.com/spotlight/blackbirdcraven

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 16 May 2014
Article Copyright 2014 by B. Clay Shannon
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid