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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:36:12+00:00 2026-05-19T00:36:12+00:00

I have a RelativeLayout which currently has a fixed size. Widths, heights, margins, font

  • 0

I have a RelativeLayout which currently has a fixed size. Widths, heights, margins, font heights of child views are specified so everything looks just right.

I now want to scale the layout (to fit screen size). The layout should scale as if it was a flat image, so everything gets smaller in proportion (fonts, margins etc.)

I made a simplified example, below. Scaled to 0.5, this would display the text “ONE QUARTER” with margin left 200dip and margin top 120dip.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    android:id="@+id/RelativeLayout01"
    android:layout_width="1600dip" 
    android:layout_height="960dip"
    xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView 
    android:text="ONE QUARTER" 
    android:id="@+id/TextView01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_marginLeft="400dip"
    android:layout_marginTop="240dip"
></TextView>
</RelativeLayout>

Of course, I’m not asking anyone to help me hand code an algorithm to scale all these values: just wondering if there’s some simple way to achieve this…

Thanks!

  • 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-19T00:36:12+00:00Added an answer on May 19, 2026 at 12:36 am

    If you just want your app to look ok on another device then specifying things in dip and sp should do the trick.

    If you actually want to shrink or expand the scale of your app on the same device then you would have to do it manually, perhaps using themes or styles.

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

Sidebar

Related Questions

I have a RelativeLayout which has a LinearLayout as a child containing TextViews. I
In my application, I have a layout which has a RelativeLayout to which I
I have a RelativeLayout with one child as <include another.xml> like this root.xml :
I have a dynamic size RelativeLayout containing TextView with a arbitrary text. Also i
I have a RelativeLayout defined in an xml layout file named 'myview.xml' which contains
I have a some ui widgets including textview inside RelativeLayout which is clickable. My
I currently have an ImageView which i am applying a scale animation to. This
I have a RelativeLayout to which I add buttons and set their onCLickListener to
I have a RelativeLayout containing a pair of side-by-side buttons, which I want to
In My application XML layout, I have one Relativelayout, In which there are two

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.