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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:27:59+00:00 2026-06-03T22:27:59+00:00

I hope I can explain what I’m after. In essence, my users have asked

  • 0

I hope I can explain what I’m after. In essence, my users have asked me to allow different looks in my application, which I hope I can do with themes.

I hoped I could do something like this:

<style name="NewTheme" parent="android:Theme.Dark">
  <item name="labelColor">#f90</item>
  <item name="buttonColor">#fff</item>
  <item name="buttonBg">@drawable/button</item>
</style>
<style name="OldTheme" parent="android:Theme.Dark">
  <item name="labelColor">#fa0</item>
  <item name="buttonColor">#88f</item>
  <item name="buttonBg">@drawable/button_old</item>
</style>

And then reference these values in my styles.xml:

<style name="labelStyle">
  <item name="android:textColor>@labelColor</item>
</style>
<style name="buttonStyle">
  <item name="android:textcolor">@buttonColor</item>
  <item name="android:background">@buttonBg</item>
</style>

I know this syntax is wrong, but what might be the right syntax? Basically, I want to create sets of attributes (color, background, a couple other things) and select them based on theme.

  • 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-06-03T22:28:00+00:00Added an answer on June 3, 2026 at 10:28 pm

    To work with themes and styles in Android you have to:

    1. Define one or more themes in themes.xml and set the definitions of
      your styles there.

    2. Define custom attributes, a.k.a. custom styles, in attrs.xml.

    3. Describe what the values of your custom styles are in styles.xml.

    4. In your layout files, give your views a style attribute, which has a
      custom style name as their values.

    5. Set the theme of your application or activity in either
      AndroidManifest.xml or in the Activity’s onCreate(). This is done by calling setTheme() in the activity’s onCreate() method, before any call to setContentView().

    6. To change the theme, you simply need to restart your activity.

    enter image description here

    Iadvice you to look at this tutorial it deals with all that a programmer want to work on android themes (text color, text formatting, state list drawable etc …)

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

Sidebar

Related Questions

’m observing a strange behavior from my application which I hope you can explain
I hope I can explain this. I have an image which is stuck to
I hope I can explain this right I have two input fields that require
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
I hope I can explain this clearly: I have two tables with the following
hope i can explain myself... i have a login control in the masterpage. when
Hope I can explain this correctly.. Silverlight Application Telerik Reports (in a separate Class)
I hope I can explain this properly. I have a grid that is part
Here's an interesting one... hope I can explain it well... I have a collection
I hope i can explain this clearly. I have a NSMutableArray * myMut. I

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.