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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:32:30+00:00 2026-06-05T11:32:30+00:00

I am developing an Android application’s home screen and I am trying to lay

  • 0

I am developing an Android application’s home screen and I am trying to lay out 4 ImageButtons in android in the following orientation:

a | b
_____

c | d

For example A is centered in the top left of the screen, b is centered in the top right of the screen, c is centered in the bottom left of the screen, and d is centered in the bottom right of the screen. All of the images are 512×512 pixels and therefore, since they are very big, should be automatically shrunk if the screen size is small. I am not concerned with stretching them.

I have tried essentially all the different kinds of layouts in Android and I’m having a terrible time trying to figure this out, after 2.5 hours of experimentation and research I am reaching out for help. Does anyone know how to do this or of a sample open source app that does this?

  • 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-05T11:32:31+00:00Added an answer on June 5, 2026 at 11:32 am

    You should set weights on your LinearLayouts and ImageButtons and the ImageButton ScaleTypes to fitXY like so

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1.0"
            android:orientation="horizontal>
            <ImageButton
                android:src="@drawable/myimage1"
                android:layout_height="fill_parent"
                android:layout_width="0dp"
                android:layout_weight="1.0"
                android:scaleType="fitXY"/>
            <ImageButton
                android:src="@drawable/myimage2"
                anroid:layout_height="fill_parent"
                android:layout_width="0dp"
                android:layout_weight="1.0"
                android:scaleType="fitXY"/>
        </LinearLayout>
        <LinearLayout
             //same as above horizontal layout with same children for buttons 3 and 4
        </LinearLayout>
    </LinearLayout>
    

    Weights divide up the space according to percentage of total weights of children. So if two children each have weight 1.0, they get 50% of the space. In order for weights to act on that view, you should specify the dimension you would like weight calculated to 0dp. ScaleType fitXY just fits the image into the space available to the ImageButton.

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

Sidebar

Related Questions

i am developing android application website address how can implemented validation example : www.yahoo.com
I am developing android application. I am finding following problem which isdisplayed by output
I am developing Android application. In my application, I have to capture a screen
I am developing an Android application where I get the following exception while writing
I'm developing an Android application where I want to pin out certain spots/addresses on
I am developing android application in which i have to open option menu from
I have been developing Android application for Android 3.x and now I want to
I am developing android application, and I want to implement PHP as backend. I
I am developing Android Application for Chat between two users as private session .
I'm currently developing an Android application that fetches images using http requests. It would

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.