Search code examples
androidandroid-layoutandroid-linearlayoutandroid-relativelayout

Is it possible to put some Buttons in a Linear or Relative Layout in variable rows?


I want to have only 1 layout. In this layout there is a linear or relative layout which I have put some buttons in it.

If the device is small, my buttons does not fit to the LinearLayout and some of them go outside the activity and are not visible like this:

enter image description here

I want to do something that when the device screen is small, the extra buttons go to the second line automatically like this:

enter image description here

Is it possible? Is there any properties in LinearLayout or RelativeLayout that satisfy this need?


Solution

  • Another option for you is to try android-flowlayout library