Tushar Pal
Tushar Pal

Reputation: 523

showing header content of application

String.xml

<string name="HomeActivityTitle">Placement Cell</string>
<string name="FeedbackActivityTitle">Feedback</string>
<string name="EclairActivityTitle">Placement Record</string>
<string name="FroyoActivityTitle">Cdc Team</string>
<string name="GingerbreadActivityTitle">News Feed</string>
<string name="HoneycombActivityTitle">Student Forum</string>
<string name="ICSActivityTitle">Assessment Test</string>
<string name="JellyBeanActivityTitle">Recruiters Info</string>

</resources>

placement-regi.xml

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:text="Placement Registration form" />

i need some help regarding how to display my text on header

Upvotes: 0

Views: 50

Answers (2)

Iamat8
Iamat8

Reputation: 3906

add this to your string.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="STRING NAME">Text you want to display</string>
....
</resources>

and this to your placement-regi.xml textview attribute

<TextView
    ...
    android:text="@string/STRING NAME"/>

Upvotes: 0

M D
M D

Reputation: 47817

Saved your string at res/values/strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello!</string>
</resources>

This layout XML applies a string to a View:

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

This application code retrieves a string:

String string = getString(R.string.hello);

Upvotes: 1

Related Questions