dimanche 24 juillet 2016

Create new button and add it in next position

how can I create a button programmatically

Button x = new Button (this);

but this button I add it in next available position. Now, if I do this and reach four created buttons, the fifth one will be outside the screen. How can I let the fifth one check if there is enough space to the right, if not, then the button would be created below the rest.

I tried grid layout and increase the column number but it is not good as I want to support Android 7.

Aucun commentaire:

Enregistrer un commentaire