简体   繁体   中英

how to distribute leftover space between buttons

Is there any way i can accomplish the following, i've looked around but can't seem to find a solution:

I have 5 buttons inside a LinearLayout and Im defining the buttons width and height programmatically. There is no space between the buttons, so it looks like this:

(x=button)
|    xxxxx    |

How can I tell the layout to distribute any leftover space on either side of the group of buttons to be evenly distibuted BETWEEN the buttons, making the layout look like this:

(x=button)
| x x x x x | 

According to me, this ain't possible with attributes of your LinearLayout.

You can choose to add an empty view or spacer between your buttons, or give your buttons margin or padding where needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM