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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:12:15+00:00 2026-05-22T23:12:15+00:00

I have one little problem…Here is my code..Is there a way to distribute weights

  • 0

I have one little problem…Here is my code..Is there a way to “distribute weights evenly” for those buttons what I made.. I tried to button[i].setWidth().. but when I turn around my phone it looks ugly.. so Is there away to distribute buttons width auto?

    ViewGroup row1 = (ViewGroup)findViewById(R.id.TableRow02);
    ViewGroup row2 = (ViewGroup)findViewById(R.id.TableRow04);
    ViewGroup row3 = (ViewGroup)findViewById(R.id.TableRow06);
    ViewGroup row4 = (ViewGroup)findViewById(R.id.TableRow08);
    ViewGroup row5 = (ViewGroup)findViewById(R.id.TableRow10);

    Button button[] = new Button[36];
    for(int i=1;i<36;i++)
    {
        button[i] = new Button(this);

        if(i==32||i==33||i==34||i==35){button[i].setVisibility(-1);}

        button[i].setText("700€");
        button[i].setTextSize(10);
        button[i].setWidth(20);

     // Insert buttons in rows
        if(i<8){row1.addView(button[i]);}
        else if(i<15){row2.addView(button[i]);}
        else if(i<22){row3.addView(button[i]);}
        else if(i<29){row4.addView(button[i]);}
        else if(i<36){row5.addView(button[i]);}
    }
  • 1 1 Answer
  • 3 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-22T23:12:16+00:00Added an answer on May 22, 2026 at 11:12 pm

    Tactically, put the buttons in a LinearLayout and set android:layout_weight="1" for each of them.

    Strategically, design a decent UI, one that does not involve a row of 36 buttons.

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

Sidebar

Related Questions

I have a little problem. I have one 1 RichTextBox and 2 Buttons. I
I have a little problem with following VHDL code: process (zbroji) begin if rising_edge(zbroji)
I have a little problem with AlertDialogs in my application. So here is my
Hey guys! I have this little problem: I have one ViewController which adds 2
I have 'little' problem with javascript numbers and NaN . I'm retrieving one single
Hello I have a little problem with assigning property values from one lists items
I have little problem in my iPhone application code but can not identify. please
I have a little problem with my MysqlConnection objets. I have those two connection
I using dropkick js to style dropdown forms but have one little problem. What
I have a little problem, I just made a menu with some asp:hyperlink structured

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.