0
\$\begingroup\$

Basically, I have a main menu, and I would like the background image to scroll (parallax I believe is the term? Like the Angry Bird's title screen background).

However, I'm used to just having a variable iterate (x++) and setting that as the x value so the image scrolls.

So is there any way to confer variables and such between xml and my java files so I can use iteration? Or can I skirt this completely somehow?

\$\endgroup\$
1
  • \$\begingroup\$ It may actually be best I avoid xml sheets altogether and just do hard coding in Java, so I can implement "complex" effects like this. \$\endgroup\$
    – A13X
    Mar 10, 2013 at 4:58

1 Answer 1

3
\$\begingroup\$

You can check this example of mine which scrolls the background. But I would not recommended that you have widgets or views on top of a SurfaceView animations. AngryBirds I believe draws its own graphics interface as all good games do.

https://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas/4946893#4946893

\$\endgroup\$
2
  • \$\begingroup\$ Yes I found a tutorial on making an interface so I can write Java classes instead of working with the GUI activity xml layout >.< \$\endgroup\$
    – A13X
    Mar 28, 2013 at 1:47
  • \$\begingroup\$ +5 :)) Trying to learn how to do these things, I've read a ton of tutorials and code. Your example (StackOverflow link) stands out among the best. The code is simple, clean, and directly addresses several key issues. So on a meta-level, it is in itself an example of a great example. Content-wise, it's spot on because it shows both non-threading and threading on the one hand and view extensions versus surface views on the other - while throwing in the use of canvas and bitmap. All key factors in learning basic game graphics on Android. Kudos! \$\endgroup\$ Oct 14, 2013 at 16:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .