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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:20:09+00:00 2026-05-18T02:20:09+00:00

After designing layouts in Android for a while now, I still cannot get the

  • 0

After designing layouts in Android for a while now, I still cannot get the hang of it. Often the results are unpredictable.

I think part of this boils down to some layout options not working well together. I.e. if you are using one way of specifying your layout, you’re not meant to use some other way.

Notably, for me, changing layout_width from fill_parent to wrap_content usually changes the world. Let me give you another specific example:

Part of my activity’s layout is a LinearLayout:

    <LinearLayout android:id="@+id/ll2" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="horizontal">
        <LinearLayout android:id="@+id/ll2a" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1">
            <TextView android:id="@+id/l_cover" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="@string/book_item_l_cover">
            </TextView>
            <ImageButton android:id="@+id/i_cover"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:scaleType="centerInside" android:gravity="center"
                android:layout_weight="1" android:adjustViewBounds="true"
                android:src="@drawable/spinner_black_76" android:minWidth="400dip">
            </ImageButton>
        </LinearLayout>
        <LinearLayout android:id="@+id/ll2b" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1">
            <TextView android:id="@+id/l_back_cover" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="@string/book_item_l_back_cover">
            </TextView>
            <ImageButton android:id="@+id/i_back_cover"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:scaleType="centerInside" android:gravity="center"
                android:layout_weight="1" android:adjustViewBounds="true"
                android:src="@drawable/spinner_black_76">
            </ImageButton>
        </LinearLayout>
    </LinearLayout>

To get 2 columns of left-aligning label-button combinations next to eachother I had to use the layout_weight attributes. The ImageButtons shrink around their images due to the adjustViewBounds attributes. This gets me a pretty good result.

Now what I finally also wanted was to have buttons of a certain minimum size so a finger can always easily press them, even when they do not contain any image (and they will shrink to only a few millimeters). I experimented with setting android:minWidth="400dip" as you can see. I expected the button to fill up the entire half of the screen in width (400 is quite a large value), but I’m not seeing any difference.

I guess one of the other attributes above is preventing minWidth from having any impact. And I could probably go experiment and disable some others to see what it gives me. But my question here is: does anybody have any (logical) information on which attribute prevents or counter-intuitively influences whichother? I’d like to get this sorted once and for all. Is this documented somewhere?

  • 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-18T02:20:10+00:00Added an answer on May 18, 2026 at 2:20 am

    I’ve noticed that layout_weight seems to render minWidth useless.

    Given three buttons in a linear layout, with the weight of the left and right to 0, and the center to 1, changing the minWidth of any of these has absolutely no effect on the way the view is rendered, until I remove the layout_weight attributes entirely for each button. I even made sure that the sum of all minWidths is less than the total view’s width.

    I have no idea why that is the case. The documentation regarding layout_weight:

    This attribute assigns an “importance”
    value to a view, and allows it to
    expand to fill any remaining space in
    the parent view. Child views can
    specify an integer weight value, and
    then any remaining space in the view
    group is assigned to children in the
    proportion of their declared weight

    I’d also really love to know what other layout parameters conflict with each other. It seems very unintuitive to me that defining a weight for a view to fill “remaining space in the parent view” would completely disregard the view’s minWidth settings.

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

Sidebar

Related Questions

After some time researching and trying different things I still cannot get my @ExceptionHandler
I want to make my usercontrol with yellow background while designing. After design it
So, after spending the last week carefully designing and planning out my app, a
I'm designing a new web project and, after studying some options aiming scalability, I
I'm designing a question-and-answer Ruby on Rails application. After a user logs in, you
I'm designing a music player app for Android that will feature pop-up controls. I'm
I am designing a GUI that has the following basic idea (similarly modeled after
After working strenuously on a project using AJAX + PHP designing a matching quiz
I have a strange problem, I was designing a page and after I finished,
After reading a number of questions regarding abstract classes and interfaces, I am still

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.