I wanna set 3 Buttons horziontal side by side. If I start the app the buttons should be in a different position. How can I do this? :) Thanks for your help :)
Asked
Active
Viewed 33 times
0
-
Can you please share what exactly you want to do? You want to set 3 buttons side by side and then you are saying it should be in different position? What does that mean? – DroidAks Oct 24 '15 at 08:04
-
I am sorry. I want 3 buttons that change their predefined position at random among each other. I hope you understand. :/ For exemple: button1 is on the right, button2 in the middle and button3 on the right. Another possible arrangement would be button2 - button3 - button1...You understand? :) – Wilhelm Müller Oct 25 '15 at 15:23
1 Answers
0
OnCreateView get the button id of button eg first button
Button myButton1 = (Button) findViewById(R.id.); myButton1.setX(); myButton1.setY();

Ashish Rawat
- 5,541
- 1
- 20
- 17
-
thx but how can I do this random? so that every start the buttons are on a different position. For example by first start:button1 - button2 - button3; second start: button2 -button3 - button1. You understand ;)? – Wilhelm Müller Oct 25 '15 at 10:59
-
give button ides appended by numbers like button+x, and generate x randomly as follows http://stackoverflow.com/questions/6029495/how-can-i-generate-random-number-in-specific-range-in-android – Ashish Rawat Oct 25 '15 at 13:15