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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:20:05+00:00 2026-05-23T13:20:05+00:00

I’m trying to create a layout with 4 buttons, where the top on button

  • 0

I’m trying to create a layout with 4 buttons, where the top on button will be centered. The center 2 buttons will be on the right and left hand side and on the same row. So it will sort of look like a circle.
I’m putting the center 2 buttons in a horizontal LinearLayout. I set the gravity of the first button to left, the second one to right. The button that has centered set to right, gets drawn right after the button before it, not on the right hand side. I set the layout width of the Linarlayout to fill parent.
Android: Cannot get button to be drawn in right hand side in LinearLayout
Why wont the button get drawn on the right hand side????

xml code

<ImageButton android:id="@+id/bAbout"       
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/about"
    android:layout_gravity="center" 
/>

<LinearLayout android:id="@+id/mainLayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <ImageButton android:id="@+id/bVedio"       
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/about"   
        android:layout_gravity="left"   
    />

    <ImageButton android:id="@+id/bBlog"        
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/about"
        android:layout_gravity="right"      
    />

</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-23T13:20:05+00:00Added an answer on May 23, 2026 at 1:20 pm

    Since you’re not looking to layout your items in a “line”, maybe you shouldn’t use LinearLayout. Try RelativeLayout and look at the properties layout_alignParentTop, layout_alignParentBottom, layout_alignParentRight and layout_alignParentLeft. See here.

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

Sidebar

Related Questions

I'm trying to create a view with 2 buttons on top(1 at left hand
I'm trying to create buttons after i press a button ( this one is
I am trying to create a listview with add button on the side as
I'm trying to create a custom layout container, with the same characteristics of StackPanel,
Been trying to create a layout similar to the Android Facebook app (top bar
Im trying to create a layout in flex using mxml, the layout contains a
I'm trying to create a layout similar to this: alt text http://img20.imageshack.us/img20/3533/stackn.png Here's the
I'm trying to create a layout with display: table and alike, but it seems
I am trying to just create a basic layout, but i am having trouble
I am trying to create a layout where when in Portrait mode the layout_gravity

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.