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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:35:21+00:00 2026-06-01T16:35:21+00:00

I have encountered an issue while splitting the screen using a linearLayout, My target

  • 0

I have encountered an issue while splitting the screen using a linearLayout,
My target is to split it into 9 Pisces –
When I started playing with the LinearLayout I have came to the following result:

http://imageshack.us/photo/my-images/4/firstna.png/

with the following xml code:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
    <LinearLayout
  android:orientation="horizontal"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1"
  android:baselineAligned="false">
    <FrameLayout
      android:gravity="center_horizontal"
      android:background="#aa0000"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_weight="1">
    </FrameLayout>
    <FrameLayout
      android:gravity="center_horizontal"
      android:background="#00aa00"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_weight="4"/>
    <FrameLayout
      android:gravity="center_horizontal"
      android:background="#aaaa00"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_weight="1"/>
    </LinearLayout>
    </LinearLayout>

later on when I tried to add content to the left FrameLayout it changed the ratio of this FrameLayout (which Is the problem..):

http://imageshack.us/photo/my-images/692/secondp.png/

using the following code:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
    <LinearLayout
  android:orientation="horizontal"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1"
  android:baselineAligned="false">
  <FrameLayout
      android:gravity="center_horizontal"
      android:background="#aa0000"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_weight="1">
      <LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
    android:text="row one"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"/>
<TextView
    android:text="row two"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"/>
<TextView
    android:text="row three"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"/>
<TextView
    android:text="row four"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"/>
    </LinearLayout>
    </FrameLayout>
    <FrameLayout
      android:gravity="center_horizontal"
      android:background="#00aa00"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_weight="4"/>
    <FrameLayout
      android:gravity="center_horizontal"
      android:background="#aaaa00"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:layout_weight="1"/>
    </LinearLayout>
    </LinearLayout>

I would like to have the ability to control the layouts just with the layout_weight attribute – if adding content to the FrameLayout changes its ratio I would need your help finding another container that the ratio will be saved in.
Thanks.

  • 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-01T16:35:23+00:00Added an answer on June 1, 2026 at 4:35 pm

    Wow you’re using a lot of nested layouts! Does your lefthand layout need to be a frame layout with another linearlayout inside it and then all the textviews? Or can you just replace the FrameLayout parent and move the background color to the vertical LinearLayout?

    Actually come to that, why do you need the 2nd linear layout too? You could just specify that the first linear layout has an orientation of horizontal (you have fill_parent on the height anyway) and then drop the second nested linear layout.

    Also you should probably consider changing the layout width of the FrameLayouts to 0dp so that they get resized dynamically based on the weight.

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

Sidebar

Related Questions

I've encountered a weird issue while using Reflection. So I have a domain class
I have encountered strange issue with lists in F#. I am using XamlXmlReader to
I have encountered a strange issue while listing files in a subtree which are
I am implementing instrumentation within an application and have encountered an issue where the
I have encountered odd behavior when using document.getElementById tonight. Duplicated in Firefox 3 and
I have encountered a strange behavior while executing an sql query on the Oracle
I have encountered a problem of placing data into the Table View. Here is
I have been using 9 patch images for a while now. But have come
im using MAMP on OSX 10.4.11 and while doing a form I came up
I encountered a strange issue while coding a .dll file in C with gcc

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.