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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:35:35+00:00 2026-06-07T21:35:35+00:00

I have written one style for TextView and I set that one for my

  • 0

I have written one style for TextView and I set that one for my TextView as style="@style/popup_window_text_style" working fine, no issues.

Now I want that same style to do in programmatically for my textview

TextView textView = new TextView(mContext);

Is there any way to do it programmatically in Java?

My style in styles.xml

<style name="popup_window_text_style">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:minWidth">60dp</item>
        <item name="android:padding">10dp</item>
        <item name="android:layout_marginLeft">1dp</item>
        <item name="android:layout_marginRight">1dp</item>
        <item name="android:background">@drawable/ctxmenu_btn_selector</item>
        <item name="android:textColor">@android:color/black</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">16sp</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:singleLine">true</item>
    </style>
  • 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-07T21:35:37+00:00Added an answer on June 7, 2026 at 9:35 pm

    This should work for you:

    textView.setTextAppearance(getApplicationContext(), R.style.popup_window_text_style);
    

    But note that some properties may not be affected and may have to be set manually as specified in the Android developer docs.

    Unfortunately the current SDK appears to lack any form of a setStyle() method.

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

Sidebar

Related Questions

I have written one css as foolows: <style> #box_1 #box1_bg{ width: 100px; padding-left:0px; font-family:
I have written a simple MSN -style program that will send and retrieve messages
I have written one jquery code of upload files with Web Handler. It works
I need to verify a password using reqex. I have written one and tested
I have written two scripts where one script calls subprocess.Popen to run a terminal
I have written a simple CRUD form which has one select list. However the
I have written a module similar to the following: module One class Two def
I have written a WCF REST API for third-party use. One of the things
I have written a simple memory game. You click on one of 16 cards
I am reading one file using ruby in which I have written regexp in

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.