gummy714 gummy714 - 10 months ago 41
Android Question

Set the position of a button in a layout via Java

I'm currently working on a game that has buttons changing positions. I was wondering how I could change the buttons position in a GridLayout via java code


Why don't you just simply change the X and Y.

Button myButton = (Button) findViewById(;
myButton.setX(<x value>);
myButton.setY(<y value>);