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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:19:28+00:00 2026-06-15T16:19:28+00:00

Application developed in Android 2.3.3 I am developing a calculator application. Question 1 :::

  • 0

Application developed in Android 2.3.3

I am developing a calculator application.

Question 1 :::
I have around 16 buttons. Is there a way where in I can set the width and height of all the buttons using a loop (or) without it. I want all the buttons to be uniform.

Question 2 :::
What do you think of this practice? Good or Bad? Please explain why?
Let’s say I have 4 buttons in each row. If I get the width and height of the screen programmatically and then divide (width/4) and add the margin for each button and then set the width (width/4 + margin) of the buttons respectively, will that somehow solve the problem of displaying in screens with different sizes?

  • 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-15T16:19:29+00:00Added an answer on June 15, 2026 at 4:19 pm

    Best way to equally provide the width or height of views according to device width and height, is to use weight property, lets take an example, we have a linear layout, with four buttons, of equal width:

    <LinearLayout android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">
         <Button android:layout_width="0dip"
             android:layout_weight="1"
             android:layout_height="wrap_content"
             android:text="button1"/>
         <Button android:layout_width="0dip"
             android:layout_weight="1"
             android:layout_height="wrap_content"
             android:text="button2"/>
         <Button android:layout_width="0dip"
             android:layout_weight="1"
             android:layout_height="wrap_content"
             android:text="button3"/>
         <Button android:layout_width="0dip"
             android:layout_weight="1"
             android:layout_height="wrap_content"
             android:text="button4"/>
    </LinearLayout>
    

    However, if you still want to provide layout width and height at runtime, you can use setLayoutParams(new LayoutParams(100, 100)); method.

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

Sidebar

Related Questions

I have developed application for android based mobile using Java. I have tried developing
I'm developing an android application for my University Project. I have developed the UI
I m developing an appliaction, same application was developed in Android, In Android there
I have developed a android application using phonegap. I have registered certain recievers which
I have developed and android Application and export as APK file to publish this
I have developed the android phonegap application using html page and css. But My
I have developed and published an Android application on the Android market. The phone
I'm having a go at developing my first android application and have never really
I am developing an android application. To use my app you must have an
Hi there Im new to mobile application development. I had developed Android apps using

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.