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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:51:32+00:00 2026-05-27T09:51:32+00:00

I would like to implement adjustable text size in my application for the sake

  • 0

I would like to implement adjustable text size in my application for the sake of readability – quite a few of my users have requested it. The idea is that the user will indicate a preference for larger or smaller text, I’ll store it in a SharedPreference, and then I’ll make use of that value whenever I load a new activity.

Obviously, I could load up every view that displays text whenever I initialize an activity’s layout, and then change the text size on all of them by name, but that seems verbose, error-prone, and difficult to maintain. I would prefer instead to increase/decrease size based on existing size, or even better, existing style (so that if I cared to, 12 could become 16, and 20 could become 30).

I think in my ideal world, I would be able to load all my XML-defined styles before calling setContentView, alter them, “save” them, and have those changes take effect on the layouts I load from that point forward. Having read a bit more, that seems impossible: “The Android SDK tools compile your application’s resources into the application binary at build time” and then there’s nothing in the Resources class or the AssetManager class underneath that suggests I can change these styles at run-time.

That seems to leave me with traversing my layout in each onCreate, finding the text size of every view for which that value is relevant, and setting a text size that is, say 2 sp bigger or smaller (figuring out sp based on screen density).

Anyone have any thoughts on this? Maybe some of you have been through this before?

  • 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-27T09:51:32+00:00Added an answer on May 27, 2026 at 9:51 am

    Try creating a theme.

    http://developer.android.com/guide/topics/ui/themes.html

    Themes can be applied to the whole activity. You can apply theme using setTheme of Activity.

    http://developer.android.com/reference/android/content/ContextWrapper.html#setTheme(int)

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

Sidebar

Related Questions

I would like to implement a command line interface for a Java application. This
I would like to implement a function that takes as input a size n
I would like to implement a save feature, which allows my users to save
I would like to implement an invitation system for an ASP.NET application. The system
I would like to implement settings/preferences in my application, which is written in PHP
I would like to implement an apps that allow users save the webpage including
I would like to implement captcha when registering to XMPP server. Basically I have
I would like implement a button to show another view. I have defined the
I would like to implement a text editor with syntax highlighting, how the syntax
I would like to implement a check in my application to tell the user

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.