0

How to change the existing width of a button programmatically to 1/3 of the width of the screen at maximum. By saying ‘at maximum’ I mean that if there will be enough space for a button to be 1/3 of the screen it should be resized. Otherwise the button should fit in the existing space gap (it can be for example 1/4 or even 1/5 of the screen’s width).

EDIT: I'm looking for a soultion for RelativeLayout.

Annabelle
  • 726
  • 8
  • 22
  • Too long to be reasonable to post. Button is standard and on it’s left or right it can have other elements. I’m looking for a solution not only in current project. Every working solution for RelativeLayout is welcome. – Annabelle Jun 19 '14 at 09:56

1 Answers1

1

Use a TableLayout with three columns, see this example for more details

http://www.mkyong.com/android/android-tablelayout-example/

animaonline
  • 3,626
  • 5
  • 26
  • 55