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

  • Home
  • SEARCH
  • 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 6203727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:57:59+00:00 2026-05-24T04:57:59+00:00

This is my layout file is :: <?xml version=1.0 encoding=utf-8?> <RelativeLayout android:id=@+id/relativeLayout1 android:layout_width=wrap_content android:layout_height=wrap_content

  • 0

This is my layout file is ::

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout android:id="@+id/relativeLayout1"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@drawable/bg1"
>
<!--    <RelativeLayout android:id="@+id/relativeLayo"
    android:layout_width="480dp" android:layout_height="320dp"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_marginLeft="20dp"
    android:background="@drawable/bg1"> -->



        <ImageView android:src="@drawable/lets_play"
            android:layout_width="wrap_content" android:layout_marginLeft="260dp"
            android:id="@+id/imageView1" android:layout_height="wrap_content"
            android:layout_marginTop="40dp"

            ></ImageView>


    <ImageView android:src="@drawable/show_me"
            android:layout_width="wrap_content" android:layout_marginLeft="220dp"
            android:id="@+id/imageView1" android:layout_height="wrap_content"
            android:layout_marginTop="60dp"

            ></ImageView>

        <ImageButton android:id="@+id/anim_btn_play"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_marginLeft="260dp" android:layout_marginTop="150dp"
            android:src="@drawable/play">
        </ImageButton>
</RelativeLayout>

And mobile output is like ::

![this][1]

now my problem is :: i would like to set 480 * 320 size screen and layout is starting from left. At right side there is black portion remain.i have approx ten activity and all activity are going to display same direction. now i would like to show in center like ::
![this][2]

so can you tell me solution?

  • 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-24T04:58:00+00:00Added an answer on May 24, 2026 at 4:58 am

    Easiest method is to wrap your Relative layout with something else, probably linear layout would be fine, and then:

    <linearlayout gravity=center>
        <relativelayout width=480dp height=320dp>
        ...
    

    It should quick fix your problem on particular 480×320 screen.

    BUT, I would suggest you rethink about your background image to make it possible to adopt to screens with different aspect ratio, consider looking nine-patch and make the background ‘strecthable’ or make a custom drawable that will stay in middle of screen.

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

Sidebar

Related Questions

I have a main activity with this layout file: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have the following layout in my xml file: <RelativeLayout android:layout_width=fill_parent android:layout_height=fill_parent> <FrameLayout android:id=@+id/logoLayout
I'm testing multi dpi in android, and the layout xml file seems like this:
I am designing custom dialogue in android, For this purpose I designed xml file
I have defined a dp dimension in my XML file like so: <?xml version=1.0
I have a xml file name list_row.xml, this was load in a listView: <?xml
I have a layout like this in xml format. But I need to do
I have this class: class View(object): def main_page(self, extra_placeholders = None): file = '/media/Shared/sites/www/subdomains/pypular/static/layout.tmpl'
I have been told to edit this file in Sharepoint Designer: /_layouts/KWizCom_WikiPlus/CreateNew.aspx I found
I am coding this layout as a wordpress theme and having a slight problem

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.