Android Multiple Language Support Example

This is one among the reason why android warns you about hardcoded labels in your application. If you want your application to support multiple languages or to be set to the device language the strings.xml file in the values folder is the one you should look for.

By default android sets your application language to English. If you want your application to support another language say French. All you have to do is to create a folder named ‘values-fr’ under ‘res’ folder and place the ‘strings.xml’ (like the path res/values-fr/strings.xml)
Create the stings.xml file in res/values/strings.xml as

<?xml version="1.0" encoding="utf-8"?>
<string name="app_name">My Application</string>
<string name="hello">Hello World, This is a language test application</string>
<string name="textview">This is a textview</string>
<string name="editview">This is a editview</string>
<string name="button">This is a button</string>

Create the stings.xml file in res/values-fr/strings.xml as

<?xml version="1.0" encoding="utf-8"?>
<string name="app_name">Mon application</string>
<string name="hello">Bonjour tout le monde, Il s\'agit d\'une application de test de langue</string>
<string name="textview">Il s\'agit d\'une textview</string>
<string name="editview">Il s\'agit d\'une editview</string>
<string name="button">Il s\'agit d\'un bouton</string>

Now run the application and your activity would look like

Now change the device language to french and the same activity would look like

Android - Adding Image, Text and Background to a Button

To have a button with image, text and background in android . Edit the button tag on the .xml file as follows

    android:text="My Button"
    android:textColor="#FFFFFF" >


Here the above sample code is to align the image on top of the text in a button. It is also possible to align the image to the right ,left and bottom of the text by using