Click here to Skip to main content
15,886,519 members
Articles / Mobile Apps / Android
Tip/Trick

Change an Android Layout's default header text

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
16 May 2014CPOL1 min read 18.7K   4   1
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?)*:

Image 1

* 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:

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

Now change it to:

XML
<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:

Image 2

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.

Image 3

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)


Written By
Founder Across Time & Space
United States United States
I am in the process of morphing from a software developer into a portrayer of Mark Twain. My monologue (or one-man play, entitled "The Adventures of Mark Twain: As Told By Himself" and set in 1896) features Twain giving an overview of his life up till then. The performance includes the relating of interesting experiences and humorous anecdotes from Twain's boyhood and youth, his time as a riverboat pilot, his wild and woolly adventures in the Territory of Nevada and California, and experiences as a writer and world traveler, including recollections of meetings with many of the famous and powerful of the 19th century - royalty, business magnates, fellow authors, as well as intimate glimpses into his home life (his parents, siblings, wife, and children).

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, including a two-volume social and cultural history of the U.S. which covers important events from 1620-2006: http://www.lulu.com/spotlight/blackbirdcraven

Comments and Discussions

 
Questionandroid layout's default header text Pin
Member 1447072025-May-19 18:45
Member 1447072025-May-19 18:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.