-2

Just need some help. I am currently making an application for our project. My application get the user input which is number because it gets the quantity of the object. My problem is how i will make object to put on it's desired coordinates. Example chair and i enter quantity of 2 then if you click the button you will be directed to next page then you will see the 2 chairs. thats the interface of application when the user use it. but we need to put coordinates to the chair so that it likes generating object and arrange them to our desired coordinates.

Thanks Guys. :)

Jerex
  • 38
  • 1
  • 8

1 Answers1

0

Do you actually need to calculate screen coordinates yourself? It would probably be easiest to build a LinearLayout and then add items to it in a loop.

See the first answer here for details on how you can do that: Android: Add a textview to linear layout programmatically

You could do the same with a RelativeLayout if you need more complicated positioning, or an AbsoluteLayout if you want total control over positioning. I would be hesitant to use those unless you have a need that's not met with the LinearLayout.

Community
  • 1
  • 1
ravuya
  • 8,586
  • 4
  • 30
  • 33