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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:23:19+00:00 2026-06-12T08:23:19+00:00

I have a screen layout that includes 3 Button controls contained within a linear

  • 0

I have a screen layout that includes 3 Button controls contained within a linear layout (horizontal). The Buttons each have a background image. See XML below :

<LinearLayout
    android:id="@+id/notificationform_llt_ApprovalBtns"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:orientation="horizontal"
    android:paddingLeft="8dp"
    android:paddingRight="8dp" >

    <Button
        android:id="@+id/notificationform_btn_Approve"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_approve"
        android:onClick="btnApprove_Click" />
    <Button
        android:id="@+id/notificationform_btn_Reject"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="@drawable/btn_reject"
        android:onClick="btnReject_Click" />
    <Button
        android:id="@+id/notificationform_btn_Delegate"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_delegate"
        android:onClick="btnDelegate_Click" />
</LinearLayout>

The screen looks great on my Galaxy W phone (3.7″), but when running on my Nexus 7 the buttons are stretched horizontally but not vertically and therefore look squashed. If I understand it right both these devices have similar resolution and both look for images in the drawable-hdpi folder which is where my images are stored. I’ve tried making the images 9-patch but this didn’t make any difference. How can I make the images scale proportionally on both height and width?

  • 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-12T08:23:20+00:00Added an answer on June 12, 2026 at 8:23 am

    The buttons get stretched horizontally because the LinearLayout is set to fill parent, and each button have weights that make them stretch. The heights are set to wrap_content, and there isn’t any content. The image is set as a background, which won’t have any effect on how big the button is.

    It’s probably best you change the Buttons to ImageButtons and use android:src instead of android:background. For example :

    <ImageButton
        android:id="@+id/notificationform_btn_Approve"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:src="@drawable/btn_approve"
        android:onClick="btnApprove_Click" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to align the buttons bottom of the screen.In the layout i have header
We have a WinForms application that includes controls such as picture boxes that are
I have a layout which includes a GLSurfaceView which takes up the whole screen.
I have an Android game that includes a screen that lists all ongoing games,
I have a layout that is three linear layouts. The top has some icons
I have an issue with how to organise the the screen layout for my
I have selected two components in the Customize Layout screen using a hint from
I have designed the screen using this relative layout. <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a simple screen created in xml, the parent layout is a relativelayout
I have an activity with the following layout. So in this screen, initally the

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.