Hi Steve, Thanks for the answer. Basically, I want to build a speedometer using 2 images (meter image and pointer image). So I used Layered Layout with the pointer image in front of the meter image. Since the meter is a half circle type, I have to move the pointer image to the right position and then I can rotate the pointer image to indicate speed. I was able to move the pointer image to the right place by changing Padding/Margin or by increasing the height of the pointer image (adding a transparent image below it), but the "blank space" below the speedometer increased and other components below it didn't fit the screen.
Answers to your questions: 1) Other components shouldn't move 2) It will be permanent, except the rotation of the pointer 3) I would like to animate the pointer movement. Thanks and regards, David On Monday, March 20, 2017 at 5:21:43 PM UTC-3, Steve Hannah wrote: > > It is the job of the layout manager to set size/position of components. > If you explicitly set the x, y, width, height, of a component, your changes > will be "wiped out" the next time any of the component's parents are > revalidated/laid out again. > > You can set the preferredSize (`setPreferredH()`, `setPreferredW()`), but > these methods are marked deprecated to discourage use as it is better to > use a layout manager for this sort of thing. > > If you can describe a little bit more about what you are trying to do, > then I might be able to offer more specific advice. Things to think about: > > 1. What will happen to the other components in the form when you resize > and reposition the component? Do they get moved or shifted at all? > 2. Is this a new "permanent" state for the form, or is this just a > temporary "highlight" that will be soon removed? > 3. Do you want to animate the component on the size change, or just "jump" > to a new position? > > Steve > > On Mon, Mar 20, 2017 at 5:55 AM, David <[email protected] <javascript:>> > wrote: > >> Hi, >> >> I would like to change position of a component dynamically (when a button >> is pressed or after a period of time). >> I tried to use setWidth/height/x/y, but every time the screen is touched >> or rotated, the components goes back to its original position (defined on >> the layout manager). >> >> Is it possible to change a component position different to the position >> set on layout manager? >> >> Thanks, >> >> David >> >> -- >> You received this message because you are subscribed to the Google Groups >> "CodenameOne Discussions" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <javascript:>. >> Visit this group at >> https://groups.google.com/group/codenameone-discussions. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/codenameone-discussions/bdc3f6bc-09c4-4239-ac78-c862a4a72daa%40googlegroups.com >> >> <https://groups.google.com/d/msgid/codenameone-discussions/bdc3f6bc-09c4-4239-ac78-c862a4a72daa%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Steve Hannah > Software Developer > Codename One > http://www.codenameone.com > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/d622fbbf-e31f-46c8-8d93-1c8bca71a985%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
