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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:09:39+00:00 2026-05-30T12:09:39+00:00

I cannot figure this one out, but I cannot seem to get android to

  • 0

I cannot figure this one out, but I cannot seem to get android to ever cooperate with simple math. I have created a ZoomControls that changes text size of a TextView. Seems simple. I increase the font size no problem. Subtracting just adds it for some weird reason.

zoom.setOnZoomOutClickListener(new View.OnClickListener() {
    public void onClick(View v) {
       float val = songtext.getTextSize();
       float test = (val - 1);
       songtext.setTextSize(test);
    }
});

Judging by this simple code, the font size should be subtracted by 1 everytime the button is pressed. Instead it increases by 1. ??? I am ripping my hair out.

  • 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-30T12:09:40+00:00Added an answer on May 30, 2026 at 12:09 pm

    The difference here is that in the setTextSize(int size) method, the
    unit type by default is “sp” or “scaled pixels”. This value will be a
    different pixel dimension for each screen density (ldpi, mdpi, hdpi).

    getTextSize(), on the other hand, returns the actual pixel dimensions
    of the text.

    You can use setTextSize(int unit, int size) to specify a unit type.
    The values for this can be found in the TypedValue class, but some of
    them are:

    TypedValue.COMPLEX_UNIT_PX : Pixels

    TypedValue.COMPLEX_UNIT_SP : Scaled Pixels

    TypedValue.COMPLEX_UNIT_DIP : Device Independent Pixels

    As explained at TextView.setTextSize behaves abnormally – How to set text size of textview dynamically for different screens by kcoppock

    I simply used the below:

    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX,size + increaseTextBy);

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

Sidebar

Related Questions

I am learning to use polymorphism in C#, but cannot figure out this one.
I just cannot figure this out, it looks really simple but I'm relatively new
My Friends, I spent quite some time on this one... but cannot yet figure
Ok sorry this might seem like a dumb question but I cannot figure this
I cannot figure out why I get this error during check-in. I checked in
I have this little problem, that I cannot figure out which arguments to pass
I know this is probably really obvious, but I cannot figure out why I
After loosing much sleep I still cannot figure this out: The code below (its
I cannot figure out how to convert this code from C# to VB.net. It
I have the code below (I know this is only one function out of

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.