Move images on screen

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Move images on screen

Postby mpathare » Sat Apr 11, 2009 10:49 pm

I have created the following imageView

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. ImageView i = new ImageView(this);
  3.  
  4. i.setImageResource(c.getImage());
  5.  
  6. i.setAdjustViewBounds(true);
  7.  
  8. i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  9.  
  10. i.setMaxHeight(80);
  11.  
  12. i.setMaxWidth(80);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


I then add it to my layout
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mLinearLayout.addView(i);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Is there a way I can have this imageView displayed at specific screen coordinates? Are there methods that set the X and Y coordinates of the imageView? I plan to have user click the image and move it around on the screen.

Thanks.
mpathare
Developer
Developer
 
Posts: 26
Joined: Sat Apr 11, 2009 10:43 pm

Top

Postby padde » Sun Apr 12, 2009 8:16 pm

If you want to move the imageview accross the screen you have to use a AbsoluteLayout.
In an AbsolutLayout you can set absolut positions :)

Greets
Padde
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests