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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:10:20+00:00 2026-05-27T08:10:20+00:00

i have a home screen with header and footer and in between i have

  • 0

i have a home screen with header and footer and in between i have ten rows of text to display. the text size is hard coded in java but when i run the app the footer gets stretched to adjust with the text size fixed. but it looks odd when it gets stretched. is there a way to assign the text size dynamically based on the screen. please help me with this, if you could look at the image you will understand the footer problem.

if (dpiClassification == DisplayMetrics.DENSITY_HIGH) {
        if (isTablet) {
            textSize = (int) (((d.getHeight() - (totImageHeight)) / 10) - (25 * dm.density));
        } else {
            textSize = (int) (((d.getHeight() - (totImageHeight)) / 10) - (11 * dm.density));
        }

    } else if (dpiClassification == DisplayMetrics.DENSITY_MEDIUM) {
        if (isTablet) {
            textSize = 90;// (int) (((d.getHeight() - (totImageHeight)) /
                            // 10) - (15 * dm.density));
        } else {
            textSize = (int) (((d.getHeight() - (totImageHeight)) / 10));
        }
    } else {
        textSize = (int) (((d.getHeight() - (totImageHeight)) / 10));
    }
  • 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-27T08:10:21+00:00Added an answer on May 27, 2026 at 8:10 am

    Try to set your text size in DP and dynamically convert DP to PX and put this PX values in

    *.textSize(pxValue);
    

    To convert I use next Code:

    private static DisplayMetrics metrics = null;
    private static float density = 0.0;
    
    private int dpToPxConverter(Context context, int dp){
            if (metrics == null) {
                metrics = context.getResources().getDisplayMetrics();
                density = metrics.density;
            }
            return (int) (density * dp + 0.5f);
        }
    

    Hope it help you!

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

Sidebar

Related Questions

I have a home-screen widget that has an icon that starts/so pose to bring
I am creating a application in I have a home screen. On that home
I have an app that applies wallpaper to the home screen with images that
I have a widget that acts as a launcher on the home screen. How
I have an app that uses webView. In the home screen of a website
I am trying to show some news in the home screen and I have
I have created a webapp that can be saved to the Home Screen on
I have to show a popup window on click of home screen button. I
in my Home Screen i have set one image as background, And set Three
I have my own application home screen as default home screen for my android

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.