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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:23:35+00:00 2026-05-25T11:23:35+00:00

I have exactly 5 buttons in my layout. The problem i am facing while

  • 0

I have exactly 5 buttons in my layout. The problem i am facing while displaying the layout is – the remaining space of the layout is being wasted rather is empty. I wanted to reduce the screen size so that it didn’t look half-way blank.

Following is the code i have written in the XML :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
    <!-- I want to eat button -->
    <Button android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="@string/iWantToEat"
    android:textSize="20sp" android:id="@+id/iWantToEat">
    </Button>

    <!-- Categories -->
    <Button android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="@string/Categories"
    android:textSize="20sp" android:id="@+id/Categories">
    </Button>

    <!-- Explore/Discover -->
    <Button android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="@string/Explore"
    android:textSize="20sp" android:id="@+id/Explore">
    </Button>

    <!-- Search -->
    <Button android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="@string/Search"
    android:textSize="20sp" android:id="@+id/Search">
    </Button>

    <!-- My Favorites -->
    <Button android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="@string/myFavourites"
    android:textSize="20sp" android:id="@+id/myFavourites">
    </Button>

</LinearLayout>

Is there a way to achieve it ?

Adithya.

  • 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-25T11:23:35+00:00Added an answer on May 25, 2026 at 11:23 am

    I think this is what you want.

    First make the root LinearLayout height to *fill_parent* so that it fills the entire screen

    Then put the buttons inside another LinearLayout with android:layout_weight=”1″ as shown below

     <LinearLayout 
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        >
             <!-- I want to eat button -->
            <Button android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:textSize="20sp" android:id="@+id/iWantToEat">
            </Button>
        </LinearLayout>
    

    It divide the screen to 1:1:1:1:1 ratio

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

Sidebar

Related Questions

i have used absolute layout in order to display image buttons in my application's
Pretty much exactly as it sounds. I have buttons in a Wx.Frame that are
Do these two keywords have exactly the same effect, or is there something I
I have two LINQ objects which have exactly the same columns and I would
I have two webservices that have exactly the same methods and signatures but point
Looks like operator new and operator new[] have exactly the same signature: void* operator
vb.net windows forms question. I've got 3 forms that have exactly the same functions,
The question I have is exactly same in requirement as How to pass mouse
I am following the django tutorial here . I have copied everything exactly. After
I have four tables containing exactly the same columns, and want to create 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.