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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:52:17+00:00 2026-05-15T12:52:17+00:00

I thought I have understood the XML layout of Android, but it seems that

  • 0

I thought I have understood the XML layout of Android, but it seems that I haven’t.
I want to have four ImageViews on one screen, to view four images at the same time.

It should look like this, where A to D represents the image views:

DDDAAA
DDDAAA
BBBCCC
BBBCCC

How can I do that? I tried it this way, but it’s not working. The Eclipse Editor seems not to be very good for this either. Is there a better one to create those layouts ?

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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TableRow>
<ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:layout_width="wrap_content" ></ImageView>
<ImageView android:id="@+id/ImageView02" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
  </TableRow>

  <TableRow>
<ImageView android:id="@+id/ImageView03" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
<ImageView android:id="@+id/ImageView04" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>
  </TableRow>
</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-05-15T12:52:18+00:00Added an answer on May 15, 2026 at 12:52 pm

    What about :

    • a LinearLayout, with vertical orientation, that would contain everything
    • and, then, a first LinearLayout, with horizontal orientation
      • that would contain D and A,
    • and the same kind of LinearLayout with horizontal orientation, a second time, for B and C

    And using

    • android:layout_weight
    • and android:gravity="center"

    so each Layout takes enough place and is centered ?

    A bit like this, I’d say :

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        >
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:layout_weight="1"
            >
    
            <LinearLayout
                android:id="@+id/DashboardNewPost"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:layout_weight="1"
                android:gravity="center"
                >
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/new_post"
                />
            </LinearLayout>
            <LinearLayout
                android:id="@+id/DashboardPostsList"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:layout_weight="1"
                android:gravity="center"
                >
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/posts_list"
                />
            </LinearLayout>
    
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:layout_weight="1"
            >
            <LinearLayout
                android:id="@+id/DashboardCommentsList"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:layout_weight="1"
                android:gravity="center"
                >
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/comments_list"
                />
            </LinearLayout>
    
            <LinearLayout
                android:id="@+id/DashboardBlogParameters"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:layout_weight="1"
                android:gravity="center"
                >
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/blog_params"
                />
            </LinearLayout>
    
        </LinearLayout>
    
    </LinearLayout>
    

    I suppose (not tried) that you could even remove the LinearLayout that’s just arround each ImageView, adding the attributes it has to the ImageViews instead…

    (In the application I took this from, I had to add those LinearLayout because there are more than only those images)

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

Sidebar

Related Questions

I would have thought that this would be an easy thing to do, but
I thought I have seen this somewhere but can't find it any more on
I came across this code on reddit . I would have thought that type
I have always thought that in order to connect to SQL server using windows
I have never thought about until recently, but I'm not sure why we call
I have a 2.3.3 android app that I am developing that I would like
In short, when you have planned or have thought about an idea to create
Before answering, it is not as easy question as you might have thought about
http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking Why is this line needed? System.GC.SuppressFinalize(tl.leakDetector); I would have thought the finalizer should
I have always thought it was best practice to be explicit in naming my

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.