Issue
I'm new at Android Game Development I already read (Dummies Android Game..., Sams Teach..). I want to draw now several images (tiles) to create my map, but I also want that they are automatically scaled to the device screen as good as possible. At the moment I just know how to use images from folder drawable but they are not scaled to the screen...
I already saw some examples where they use xml files to get to images over R.id.... but for this I must use the xml as layout in the code and can't use something like this or?
//create the view object
view = new SurfaceView(this);
setContentView(view);
view.setOnTouchListener(this);
I'm a little bit confused... :(
How do other Game Programmer scale their images to the different device screens?
I would be very thankful for some examples!!!
Solution
When you use xml
for drawables these are located to the drawable/
folder and not the layout/
folder.
In order to use them you call R.drawable.name_of_your_drawable
not R.id....
nor R.layout....
.
Another way to avoid blurring in larger screens is to provide different resources for different screen dpis for this option you have to place your drawables to
drawable-mdpi/
drawable-hdpi/
drawable-xhdpi/
- etc
Note: that when you use multiple folders each drawable must have the exact name in all folders and the system decides which to pick.
Answered By - madlymad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.