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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:18:33+00:00 2026-06-08T02:18:33+00:00

I am working on a fragment with 5 buttons in it. When its on

  • 0

I am working on a fragment with 5 buttons in it. When its on a larger screen like a tablet I use a fragment that places all 5 buttons at the top. I set all their layout_width to 1 but the buttons do not spread evenly across the screen like is expected.

EXPECTED
[ all ][ my ][buttons][ go ][ here ]

WHAT I GET
b1 b2 b3 b4 b5 b3 and b5 are just one button… just showing it breaks one word
[all][my][but ][go][her] and puts it one line down.
[tons] [e ]

I have been playing with it and trying different things but I cant get it to change. Any help is appreciated. Thank you.

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

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/xlarge_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
    android:id="@+id/tip_btn"
    android:layout_width="0px"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:text="@string/tip_button"
    android:onClick="tipButton">
</Button>

<Button
    android:id="@+id/preference"
    android:layout_width="0px"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:text="@string/settings"
    android:onClick="showPreferences">
</Button>

<Button
    android:id="@+id/rate_btn"
    android:layout_width="0px"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:text="@string/rate_button"
    android:onClick="rateButton">
</Button>

<Button
    android:id="@+id/feedback_btn"
    android:layout_width="0px"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:text="@string/feedback_button"
    android:onClick="feedbackButton">
</Button>

<Button
    android:id="@+id/cancel_btn"
    android:layout_width="0px"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:text="@string/exit_button"
    android:onClick="cancelButton">
</Button>
</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-08T02:18:35+00:00Added an answer on June 8, 2026 at 2:18 am

    Short answer: set the layout_width of the buttons to 0. The layout_weight is used to determine how to spread the left-over space between the elements in a layout. Therefore, if you don’t set the width to zero, the size of the content of the buttons will affect how big they are.

    Here are two good blog posts explaining how weights work:

    http://blog.stylingandroid.com/archives/297
    http://blog.stylingandroid.com/archives/312

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

Sidebar

Related Questions

Working with an undisclosed API, I found a function that can set the number
I am working on a Fragment application in Android 2.2. It so happens that
Ive been trying to get a listview working within a fragment all day. I
I'm working with an xml fragment, and finding that I'm doing the following a
I am working on a tablet application which has 2 fragments on the screen.
I have a simple code fragment in JS working with prototype inheritance. function object(o)
I am working on a project writing a GLSL fragment shader, and it just
I'm working on an iPhone project. I am getting an HTML fragment from an
i'm currently working on a Eclipse RCP Project. I have a Plugin Fragment where
I am currently working on an Android tablet application which has two fragments, a

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.