morpheus
morpheus

Reputation: 20330

How to get a reference to the TextView that displays an app's name

I want to get a reference to the TextView that displays name of the app. E.g. I have code like this in AndroidManifest.xml:

<activity
            android:name=".Jain_aartisActivity"
            android:label="@string/app_name" >

and I want to get reference to the TextView that displays the app_name string.

Upvotes: 0

Views: 213

Answers (1)

havexz
havexz

Reputation: 9590

If you just want to get the view and replace it with your own then try the below code.

activity.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
            R.layout.your_layout);

activity could be this if called from within the activity.

Edit: It worked but you have to have a unicode font on your device/emulator. Well I cant say for all devices but mine have the font pre-installed and below are the snapshots.

unicode image

my strings.xml file contain

 <string name="app_name">जैन आरती संग्रेह</string>

Edit 2:

If you have the typeface with you then just create a small layout that looks like title bar and use the above mentioned code to replace the default title bar with yours.

Upvotes: 1

Related Questions