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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:32:03+00:00 2026-05-21T04:32:03+00:00

I have defined a TableLayout in my Java code. For each row, I’m displaying

  • 0

I have defined a TableLayout in my Java code. For each row, I’m displaying three ImageButtons. When one of those buttons is pressed, the background color changes. To display it nicely, I have set a padding of 10px.

The problem I’m having now is that if you press two buttons that are next to each other, you don’t exactly see a break between the buttons. So I’m wondering, is there a possibility to set a margin on the ImageButtons or an other solution whatshowever?

  • 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-21T04:32:04+00:00Added an answer on May 21, 2026 at 4:32 am

    Try

    int leftMargin = 10;
    ((MarginLayoutParams) imageButton.getLayoutParams()).leftMargin = leftMargin;
    

    EDIT:
    If you don’t use ImageButton defined in xml, you have to set LayoutParams like this:

    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                            LayoutParams.WRAP_CONTENT);
    params.leftMargin = 10;
    b.setLayoutParams(params);
    

    Here I assume you use LinearLayout in your list item.

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

Sidebar

Related Questions

I have a TableLayout defined in my xml with three columns and four rows
I have defined a custom tag to take one parameter, a number, which it
I am using tablelayout in java file with 7 row and 7 column. In
I have defined two classes in javascript as follows. function ParentClass(){ this.one = function(){
I have defined one Thickness resource in Window's resources collection which is set to
I have defined 2 signatures and 2 modules as follows. One signature is derived
I have defined three classes: class Animal < ActiveRecord::Base end class Cat < Animal
I have defined three tables, Stores, InventoryItems and StoreItemRecords. My StoreItemRecords table has foreign
I have defined an Activity in an Android app containing 9 button. Each button
I have created a TableLayout with a listView in it. I define the listView's

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.