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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:04:25+00:00 2026-06-03T22:04:25+00:00

Basically, I have a view that needs to be split up into a 2×4

  • 0

Basically, I have a view that needs to be split up into a 2×4 grid, with each section equal in size (i.e. each row would be 25% of the screen height, and each column would be 50% of the screen width).

My approach was to use a horizontal LinearLayout with two inner LinearLayouts with a weight of 0.5 and then in each of those LinearLayouts set the weight of the children to 0.25 so that each one takes up 25% of the screen.

Although this seems to work, this is apparently very bad for performance (see this thread for a reason why Why are nested weights bad for performance? Alternatives?)

Are there any alternatives to achieve this? I have had a look around but I can’t find a pure XML solution to this.

See below a code example of how I have the LinearLayouts and their children setup

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:baselineAligned="false"
    android:weightSum="1.0"
    >
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:layout_weight="0.5"
        android:weightSum="1.0">        
            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:layout_weight="0.5"
        android:weightSum="1.0">        
            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="0dip"
                android:src="@drawable/example"
                android:layout_gravity="center_horizontal"
                android:layout_weight="0.25"
            />
    </LinearLayout>
</LinearLayout>
  • 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-03T22:04:27+00:00Added an answer on June 3, 2026 at 10:04 pm

    You might want to give the GridLayout a spin.

    There’s also a library that makes it available to 1.6+ devices.

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

Sidebar

Related Questions

I basically have 3 layers ( Window > Scene > View ) that each
I have a partial view that I want to basically take care of itself
right, basically we have a link into our system that is all lowercase but
I have an NSMutableArray that is loaded into a table view. The data in
This is a design question. I have data that needs to go into an
I have a view where the user can change some settings, its basically a
I basically have 7 select statements that I need to have the results output
I have a bunch of methods that make use of jquery to basically generate
I have a ViewFlipper implementation that needs to be improved. This ViewFlipper has three
i have a view that shows the user a form and the user should

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.