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 7443821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:23:36+00:00 2026-05-29T11:23:36+00:00

In my application, I want to set a style to the TextView which will

  • 0

In my application, I want to set a style to the TextView which will make the TextView look like a header as shown in the following figure-

"General" is the heading in this image.

When I apply the style from the styles.xml (given below), it applies the font and font color as specified. But, it does not apply the white background. Can we at all do this?

The style defined is like this-

<?xml version="1.0" encoding="utf-8"?>

<style name="settings_header">
    <item name="android:layout_marginBottom"> 10dip </item>
    <item name="android:background"> @color/white </item>
    <item name="android:paddingLeft"> 10dip </item>
    <item name="android:layout_width"> match_parent </item>
    <item name="android:layout_height"> wrap_content </item>
    <item name="android:textSize"> 22sp </item>
    <item name="android:textColor"> @color/black </item>
    <item name="android:textStyle"> bold </item>
</style>

The code which applies the style is like

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textview = (TextView) findViewById(R.id.textView);
textview.setTextAppearance(ScrSettings.this,R.style.settings_header);
}
  • 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-29T11:23:37+00:00Added an answer on May 29, 2026 at 11:23 am

    As a workaround, this works

    textview.setTextAppearance(context, R.style.settings_header);
    textview.setBackgroundResource(R.color.white);
    

    The question is still not answered fully as, setting the background to the TextView twice is not what we want. We had already set the background in styles.xml.

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

Sidebar

Related Questions

I have developed the application in which i want to set the background color
I am having one Gtk+ and C application in which i want to set
I am working on an MVC2 application and want to set the maxlength attributes
I want to set my server to automatically build my application upon commit on
In my web application we have many users.I want to set permission for each
I've just created a new view based application, and now I want to set
I want to allow users of my application to add sub-users and set privileges
I've got an application window in which I'm adding the WS_THICKFRAME style and I
I want to write a odometer-like method in a C#-style-language, but not just using
I have a facebook application that consists of a form which values i want

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.