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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:59:28+00:00 2026-06-15T13:59:28+00:00

Suppose I have a background in my Activity ‘s root layout. I wish to

  • 0

Suppose I have a background in my Activity‘s root layout. I wish to place some buttons on the screen which always stay in the same place relative to the screen. How can I accomplish that?

I tried using dp and sp but if I test the layout in another screen it all falls apart. (So if it is OK in WVGA it is not working in QVGA. Am I doing something wrong?

This is my layout xml:

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/menu_activity_bg" >
        <Button
            android:id="@+id/continueButton"
            android:layout_width="110sp"
            android:layout_height="30sp"
            android:layout_marginLeft="100sp"
            android:layout_marginTop="180sp"
            android:background="@drawable/menu_activity_continue" />
        <Button
            android:id="@+id/newGameButton"
            android:layout_width="130sp"
            android:layout_height="35dp"
            android:layout_marginLeft="90sp"
            android:layout_marginTop="220sp"
            android:background="@drawable/menu_activity_new_game" />
            <!-- ... -->
    </RelativeLayout>
  • 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-15T13:59:30+00:00Added an answer on June 15, 2026 at 1:59 pm

    My solution to this is to have a number of style types, which I place in the values-large, values-small, values-normal, and values-xlarge folders. A typical entry will look like this:

    <resources>
    <style name="bigText">
        <item name="android:textSize">60dp</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_marginTop">5dp</item>
        <item name="android:layout_marginBottom">5dp</item>
        <item name="android:textColor">#000000</item>
    </style>
    </resources>
    

    Then my layout XMLs would look like:

    <TextView
        android:id="@+id/somTextValue"
        style="@style/bigText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/someText" />
    

    Having a number of these styles, I apply them to my objects that need to scale. Trial and error will allow me to find something that works well for all screen sizes.

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

Sidebar

Related Questions

Suppose we have a BASH script running some commands in the background. At some
Suppose we have Chrome extension, that uses background page, popup page, maybe some other
Suppose I have some code which is running in the UI thread, which spawns
Suppose you have a class where you start some background thread: this class could
Suppose I have a GUI application which has a background thread which runs for
Suppose I have some information received on asynchronous sockets (therefore exits some background threads)
i have a question that suppose i have 1 png which background is transparent
Suppose I have test.sh as below. The intent is to run some background task(s)
Suppose I have some text which is displayed over an image or some other
Background: Suppose I have the following obviously-incorrect PHP: try{ $vtest = ''; print(array_pop($vtest)); }catch(Exception

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.