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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:24:36+00:00 2026-05-23T20:24:36+00:00

I just wondered if it’s possible to prevent a Button resizing when assigning long

  • 0

I just wondered if it’s possible to prevent a Button resizing when assigning long text to it.

I am wanting to place 2 rows of 4 buttons in my Layout but as soon as I change the text in one it automatically resizes squashing the others so nothing is evenly sized.

I’ve tried weight, weight sum, gravity but I have to admit my lack of understanding of these attributes!

This is my XML so far:

<?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:id="@+id/linearLayout1" 
    android:background="@drawable/backgroundrepeat" 
    android:orientation="vertical"
    android:weightSum="2">
    <ScrollView android:id="@+id/scrollView1" 
        android:layout_height="wrap_content" 
        android:layout_width="match_parent" 
        android:layout_weight="2">
        <TextView android:id="@+id/textView1" 
            android:layout_width="match_parent" 
            android:text="TextView" 
            android:layout_height="wrap_content">
        </TextView>
    </ScrollView>
    <LinearLayout android:layout_height="wrap_content" 
        android:id="@+id/linearLayout3" 
        android:layout_width="match_parent" 
        android:layout_weight="1"
        android:weightSum="4.0"
        android:gravity="left">
        <Button android:text="Button" 
            android:id="@+id/button1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_weight="1.0">
        </Button>
        <Button android:text="Button" 
            android:gravity="center"
            android:id="@+id/button2" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_weight="1.0">
        </Button>
        <Button android:text="Button" 
            android:id="@+id/button3" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_weight="1.0">
        </Button>
        <Button android:id="@+id/button4" 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content" 
            android:text="Button" android:layout_weight="1.0">
        </Button>
    </LinearLayout> 
    <LinearLayout android:layout_height="wrap_content" 
        android:id="@+id/linearLayout3" 
        android:layout_width="match_parent" 
        android:layout_weight="1"
        android:weightSum="4.0"
        android:gravity="left">
        <Button android:text="Button" 
            android:id="@+id/button5" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_weight="1.0">
        </Button>
        <Button android:text="Button" 
            android:gravity="center"
            android:id="@+id/button6" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_weight="1.0">
        </Button>
        <Button android:text="Button" 
            android:id="@+id/button7" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_weight="1.0">
        </Button>
        <Button android:id="@+id/button8" 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content" 
            android:text="Button" android:layout_weight="1.0">
        </Button>
    </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-05-23T20:24:36+00:00Added an answer on May 23, 2026 at 8:24 pm

    Add to your button attributes -any proper calculated size you want, this will limit the characters and add “…” to the text string

     <Button
        android:id="@+id/yourButtonID"
        android:layout_width="70dp"
        android:layout_height="60dp"
        android:textSize="12sp"
        android:scrollHorizontally="true" 
        android:lines="1"
        android:ellipsize="end"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wondered whether it's possible to match against the same values for multiple
I just wondered how it is possible to write a user-defined square root function
Just wondered why is it possible to pass Integer as argument where method parameter
In VisualStudio (Pro 2008), I have just noticed some inconsistent behaviour and wondered if
Just wondered if anyone could give me some advice on the best way to
Just wondered if any LINQ guru might be able to shed light on how
Just wondered if someone could clarify the use of BeginInvoke on an instance of
Just wondered if there was a secret to do something like Database.Security.Users like AdventureWorks
i just wondered if there are any alternative tools out there like Pex for
I just wondered, why most Delphi examples use FillChar() to initialize records. type TFoo

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.