Dynamic Layout of Buttons in Android Layout

0

I'm developing an application that needs to have a series of custom buttons on the home screen. The number of buttons that will be displayed will be set. Having this information in hand, how can I implement their organization to position themselves differently on the screen?

My goal is to always try to centralize them by leaving them arranged in columns and rows and having a maximum of 3 columns of buttons.

I thought about using RecyclerView but I do not know if I'll be able to do the application in this way. With your experience, what do you recommend?

    
asked by anonymous 09.04.2018 / 03:05

2 answers

0

I was able to find the way that solved my problem. What I did was implement the Grid Layout which is also a list but which is displayed in rows and columns that I can dynamically calculate to be able to display and position my elements in the best way.

I reference the video link I used: Android Studio Tutorial - Grid View

Credits and thanks to the channel EDMT Dev for the handy, fast and very well done video on the subject.

    
21.04.2018 / 04:30
0

Depending on the shape you want to position, and if it is just buttons, you can create the layout with numerous buttons, leave invisible visibility or gone (depending on the situation) and set the visibility programmatically. As each button will have its id and you can change the characteristic of each programmatically.

    
19.04.2018 / 19:35