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

  • Home
  • SEARCH
  • 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 6613429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:13:03+00:00 2026-05-25T20:13:03+00:00

I have an activity with three buttons in the layout. All the buttons are

  • 0

I have an activity with three buttons in the layout. All the buttons are at the bottom. I wanted the button to be extreme left,centre and extreme right. The extreme right and the extreme left buttons are fine. However, the centre button is taking up all the space in between the left and right button. However, I want the middle button to take necessary space and not all the space. Also, I am unable to move the imageButton to the middle of the screen. Any help with these things? Here’s my XML layout file:

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

            <RelativeLayout
            android:id="@+id/rel"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/backgroundnr"
            xmlns:android="http://schemas.android.com/apk/res/android"
            >

            <ImageButton
            android:id="@+id/imageButtons"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tempText2"
            android:layout_above="@+id/tempText"
            android:gravity="center"
            android:src="@drawable/start"
            android:background="@null"
            android:layout_gravity="center_horizontal"
            >
            </ImageButton>

            <TextView
            android:id="@+id/tempText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Touch to Start"
            android:layout_centerVertical="true"
            android:layout_gravity="center_vertical"
            >
            </TextView>

            <ImageView
            android:id="@+id/bottomlayout"
            android:layout_width="fill_parent"
            android:layout_height="100px"
            android:src="@drawable/bottombar"
            android:layout_alignParentBottom="true"
            >
            </ImageView>

            <Button
            android:id="@+id/profileButtons"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Profile"
            android:drawableTop="@drawable/profiledefault"
            android:gravity = "bottom"
            android:background="#0000"
            android:layout_alignParentBottom="true"
            android:layout_alignLeft="@+id/bottomlayout"
            android:textColor="#FFFFFF"
            android:paddingLeft="10dip"
            android:paddingBottom="5dip"
            >
            </Button>
            <Button
            android:id="@+id/savedButtons"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Saved"
            android:drawableTop="@drawable/favoritesdefault"
            android:gravity = "bottom"
            android:background="#0000"
            android:layout_alignParentBottom="true"
            android:textColor="#FFFFFF"
            android:paddingBottom="5dip"
            android:layout_toRightOf="@+id/profileButtons"
            android:layout_toLeftOf="@+id/recentButtons"
            android:layout_gravity="center_horizontal"
            >
            </Button>
            <Button
            android:id="@+id/recentButtons"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Recent"
            android:drawableTop="@drawable/recentdefault"
            android:gravity = "bottom"
            android:background="#0000"
            android:layout_alignParentBottom="true"
            android:textColor="#FFFFFF"
            android:layout_alignParentRight="true"
            android:paddingRight="10dip"
            android:paddingBottom="5dip"
            >
            </Button>
            </RelativeLayout>
  • 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-25T20:13:04+00:00Added an answer on May 25, 2026 at 8:13 pm

    use

    android:layout_centerHorizontal="true"

    for your ImageButton instead of layout_gravity.

    and to rearrange your bottom buttons.

    don’t use leftOf or rightOf for middle button which is “savedButtons” . just use

    android:layout_centerHorizontal="true"

    for it. And for the left button “profileButtons” use

    android:layout_toLeftOf = "@+id/savedButtons"
    

    for the right button “recentButtons” use

    android:layout_toRightOf = "@+id/savedButtons"
    

    In this layout middle button will occupy the center space necessary , and the remaining left and right areas are used for the remaining buttons. you will need alignParentBottom for each of 3 buttons.

    HTH.

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

Sidebar

Related Questions

I have three buttons in my Actvity inside Linear Layout. Here i wish all
I have a custom button in an activity. It works fine. I hit back,
I am using three toggle buttons if I ON first button so all 3
I have an activity with a view pager and three pages to display. When
in my app i have activity with XML layout, i want to build an
All layouts and button references mentioned in my java files all have warnings on
I have an activity that shows customer information. All the controls are drawn dynamically
Can some one tell me were i am going wrong. i have three activity's
Hello all i have a button i am trying to let users share a
I have various XML layouts. In all of those layouts I have buttons, but

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.