Values Resources:
Values Resources Provides us a text strings, Integers and color for our application with Optional styling and formatting. In Above Picture, we have one file Named String.xml located in Values Directory.
A string Resources provides text strings for Our application with Optional text styling and formatting, there are three type of resources that can provide our application with strings.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="@string/Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button1" />
</LinearLayout>
In Above Example, The string for the Button was loaded from the resources by providing the resource ID for the String As shown below.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">HelloWorld</string>
<string name="Button">Click ME:</string>
</resources>
NOTE: Consider the following tutorial "Values resources" to learn more about Values resources, and how we use it in our application.
NOTE:We Need to set Resource name according to Normal XML rules, and the name must be valid Android Resource ID. No spaces or dashes allowed.
In this tutorial, we Learn about Values resources. Here we just introduced Values resources. In our upcoming tutorials, we will learn more and will use it while writing our applications.
WRITE FOR INFOBROTHER