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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:42:30+00:00 2026-05-22T00:42:30+00:00

I was designing a layout but encountered a problem. Somehow, it has a empty

  • 0

I was designing a layout but encountered a problem. Somehow, it has a empty space on the right of my tablelayout and I can’t fill it. If anyone has an idea, then would you help me please?

Below is my layout xml and screenshot to show what exactly happes; by the way, the reason why I am using tablelayout is in order to put some items there using interaction with the user.

Thank you in advance


<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:id="@+id/header" android:layout_height="wrap_content" android:layout_width="match_parent">
    <TextView android:id="@+id/header_life_title" android:textSize="20sp" android:text="Life: " android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView>
    <TextView android:id="@+id/header_life_value" android:textSize="20sp" android:text="20" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView>
    <Button android:text="Inc." android:id="@+id/header_btn_inc" android:layout_width="wrap_content" android:layout_height="35dp" android:layout_gravity="center_vertical">
    <Button android:text="Dec." android:id="@+id/header_btn_dec" android:layout_width="wrap_content" android:layout_height="35dp"></Button>
    <Button android:text="Put L." android:id="@+id/header_btn_putLand" android:layout_width="wrap_content" android:layout_height="35dp"></Button>
    <Button android:text="Remove L." android:id="@+id/header_btn_removeLand" android:layout_width="wrap_content" android:layout_height="35sp">
    <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/land_space">
    </LinearLayout>
</LinearLayout>
    <ScrollView android:id="@+id/scrollView1" android:layout_height="wrap_content" android:layout_width="match_parent">
        <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/cardboard">
            <LinearLayout android:layout_height="40dp" android:layout_width="match_parent" android:id="@+id/layout_menu">
                <Spinner android:id="@+id/spinner_creature" android:layout_height="wrap_content" android:layout_width="150dp"></Spinner>
                <Button android:id="@+id/btn_creature" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Cast"></Button>
                <Spinner android:id="@+id/spinner_noncreature" android:layout_height="wrap_content" android:layout_width="wrap_content"></Spinner>
                <Button android:id="@+id/btn_noncreature" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Cast"></Button>
                <Button android:id="@+id/btn_delete" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Del."></Button>
            </LinearLayout>
            <TableRow android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/tableRow_cardImage"><![enter image description here][1]/TableRow>
            <TableRow android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/tableRow_cardData"></TableRow>
            <TableRow android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/tableRow_cardImage2"></TableRow>
            <TableRow android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/tableRow_cardData2"></TableRow>
        </TableLayout>
    </ScrollView>
</LinearLayout>

http://imageshack.us/m/52/2443/111iyr.jpg
  • 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-22T00:42:31+00:00Added an answer on May 22, 2026 at 12:42 am

    You could use the LinearLayout‘s layout_weight attribute to force the views inside of it to take up the space left.

    Setting the layout_weight attribute to "1" in for all child views will make them take up the remaining space equally:

    <LinearLayout android:layout_height="40dp"
        android:layout_width="match_parent" android:id="@+id/layout_menu">
        <Spinner android:id="@+id/spinner_creature"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:layout_width="150dp"></Spinner>
        <Button android:id="@+id/btn_creature"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:layout_width="wrap_content" android:text="Cast"></Button>
        <Spinner android:id="@+id/spinner_noncreature"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:layout_width="wrap_content"></Spinner>
        <Button android:id="@+id/btn_noncreature"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:layout_width="wrap_content" android:text="Cast"></Button>
        <Button android:id="@+id/btn_delete"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:layout_width="wrap_content" android:text="Del."></Button>
    </LinearLayout>
    

    The width of the child views is set to wrap_content, so they won’t get wider when you change the orientation of the phone, even though the parent has more space horizontally.
    Using layout_weight you can set the portion for each child view how much from the parent’s remaining space should fill.

    For more reference: LinearLayout.LayoutParams

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

Sidebar

Related Questions

I'm designing a really simple GUI but without any luck. Basically the outer layout
Designing forms has always been fun, but getting them to send email on the
Bear with me so I can explain the layout of my problem. I am
i've actually never encounter this problem before. I usually start designing my layout in
I am designing a master page. The layout is very simple.But height adjustment does
I'm designing this forum layout where I come up with a nice design to
I'm designing a fairly simple web site but as I don't have much experience
I am designing a layout that looks like: == header == == ad banner
I am new comer to android but not to java. I have been designing
I have a main MasterPage which has a single column layout for the web

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.