开发者

Can I user a layout on the android to render just part of an image at a time?

开发者 https://www.devze.com 2022-12-26 04:33 出处:网络
I have an image file that has all the character sprites that I will be using in a game, and I want to make a layout that will allow the user to cycle through each image to be able to pick which one th

I have an image file that has all the character sprites that I will be using in a game, and I want to make a layout that will allow the user to cycle through each image to be able to pick which one they want. So, 开发者_如何学CI have one large image, and I need to render just a small (32 x 32) section of it at a time. Is that possible with the layouts or will I have to use a canvas, and manually do most of this?


Yes Try using scrollX and scrollY. You can set these properties programmatically or in the layout xml.

That said, loading just the small images that the user needs to see is preferred to loading a large image containing all. If your image is really large you might want to consider the first option.

0

精彩评论

暂无评论...
验证码 换一张
取 消