Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:29:08+00:00 2026-05-26T20:29:08+00:00

I have a view in the XML <TextView style=@style/TitleBarText /> whose styles are defined

  • 0

I have a view in the XML

<TextView style="@style/TitleBarText" />

whose styles are defined in values/styles.xml as follows

<style name="TitleBarText">
        <item name="android:id">@+id/title_text</item>
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:layout_weight">1</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:textSize">@dimen/text_size_medium</item>
        <item name="android:paddingLeft">12dip</item>
        <item name="android:paddingRight">12dip</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/title_text</item>
        <item name="android:singleLine">true</item>
        <item name="android:ellipsize">end</item>
    </style>

When i try to set the text from onCreate of the activity like this i am getting an error

TextView titleText = (TextView) findViewById(R.id.title_text);
titleText.setText(getString(R.string.title_home));

In Eclipse i am getting this error

title_text cannot be resolved or is not a field

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:29:09+00:00Added an answer on May 26, 2026 at 8:29 pm

    You have set id of the String resource in textview
    You have to write like

    titleText.setText(getString(R.string.title_home));
    

    EDIT

    You have to set id of textview in <Textview> tag instead of writing in style of textview

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a custom view set up in code (no XML layout defined
I have a base view in XML. <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content"><TextView android:layout_height="wrap_content" android:layout_width="fill_parent"
I have a list view declared in my xml: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have an XML view in a rails app, and need to insert in
I have created XML file,but I can't view it/output it.I know there is no
I have a function in a view that renders the xml in the browser,
Let's say i have a layout with style: <LinearLAyout ... > <TextView ... style=someStyle
what I want to do in a view is have a textview and to
I have a view with a TextView and a Custom View laid out in
I have the following XML file getting populated via list view. I can't get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.