0

What I am trying to do right now is making the radio buttons or checkbox button wrap on its own. I am generating the buttons dynamically with java. How do I make it so that if it cannot fit on the row it will put the button on the next row. Looking at the image we can see the third check box is cut off the screen. How can I make that start another line?

enter image description here

2 Answers2

2

There is no way to do this in android, rather than implement a logic that is able to measure the child controls of a layout and calculate if it reaches the end of the screen, and then create a new layout row.

Take a look at this post about this subject, using a LinearLayout: Android - LinearLayout Horizontal with wrapping children

This approach is also discussed here: Android Horizontal LinearLayout - Wrap Elements

Community
  • 1
  • 1
A B
  • 338
  • 3
  • 10
1

I feel the checkbox that is getting cut out , is not the fault of the checkbox , neither will it help to wrap itself to next line , because there is no space.

Some solution that might help are :

1)Parent row layout can be made scrollable with a horizontal scroll view

2)Make a customized a layout that can calculate if it is overflowing , and manage the view into a new line of layout