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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:53:02+00:00 2026-05-25T05:53:02+00:00

I have four ImageViews in a layout. I set the maximum width for each

  • 0

I have four ImageViews in a layout. I set the maximum width for each one of them by setMaxWidth function. The problem is that they keep a small distance between them and I don’t want that. If I don’t stipulate the maximum width, these gaps disappear, but the ImageViews sizes are inappropriate (bigger than it should be).

The main code is:

    musicSubmenuButton = new ImageView(context);
    musicSubmenuButton.setId(id++);
    musicSubmenuButton.setImageResource(R.drawable.bt_musicas_on);  
    musicSubmenuButton.setMaxWidth(buttonSize);
    musicSubmenuButton.setAdjustViewBounds(true);

    photosSubmenuButton = new ImageView(context);
    photosSubmenuButton.setId(id++);
    photosSubmenuButton.setImageResource(R.drawable.bt_fotos_off);
    photosSubmenuButton.setMaxWidth(buttonSize);
    photosSubmenuButton.setAdjustViewBounds(true);

    agendaSubmenuButton = new ImageView(context);
    agendaSubmenuButton.setId(id++);
    agendaSubmenuButton.setImageResource(R.drawable.bt_agenda_off); 
    agendaSubmenuButton.setMaxWidth(buttonSize);
    agendaSubmenuButton.setAdjustViewBounds(true);

    infoSubmenuButton = new ImageView(context);
    infoSubmenuButton.setId(id++);
    infoSubmenuButton.setImageResource(R.drawable.bt_info_off);
    infoSubmenuButton.setMaxWidth(buttonSize);
    infoSubmenuButton.setAdjustViewBounds(true);

The size I wanted, but without the gaps (obtained using the above code): enter image description here

The ImageViews without the gaps, but in the original resolution (obtained using the above code, but commenting the setAdjustViewBounds calls): enter image description here

Does anybody know why these gaps appear and/or a workaround to get rid of these gaps and keep my desired size?

  • 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-25T05:53:02+00:00Added an answer on May 25, 2026 at 5:53 am

    Instead of setting max width, set layout_width on them to fill_parent. Then they will space out evenly.

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

Sidebar

Related Questions

I have some databases that have four files each; one for PRIMARY, IDX, IMAGE,
I have four UIGestureSwipeRecognizers registered (one for each direction), and they work as intended
I have four models that are related to one another, the way I have
I have four packages in my program, among them i would like one and
I have four fields, and I the function to return true if atleast one
I have four tabs that hold four listviews, I want to set a background
I have four UINavigationControllers assigned each to a tab in a UITabBarController. Each UINavigationController
I thought I have understood the XML layout of Android, but it seems that
I have set the size of the tableView that I show as the popoverController
I have four arrays that are coming in from the client. Let's say that

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.