简体   繁体   English

Android图层列表精灵表

[英]Android layer-list spritesheet

I have created a sprite sheet (single image that contains multiple images) with 4 different icons. 我创建了一个带有4个不同图标的Sprite工作表(包含多个图像的单个图像)。 I would like to create a layer-list that uses different parts of the images to make a single image, for example: 我想创建一个使用图像的不同部分制作单个图像的层列表,例如:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/spritesheet"/>
    <item android:drawable="@drawable/spritesheet"/>
    <item android:drawable="@drawable/spritesheet"/>
    <item android:drawable="@drawable/spritesheet"/>
</layer-list>

For example the sprite sheet would look something like this: 例如,精灵表看起来像这样:

雪碧表

and I would like the final result to look like this: 我希望最终结果如下所示:

在此处输入图片说明

I have tried the different options that are available here however I can't find a solution. 我尝试了这里可用的各种选项,但是找不到解决方案。

Why don't you just use the parts of the picture? 您为什么不只使用图片的各个部分?

@drawable/layers.xml, for example: @ drawable / layers.xml,例如:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
   <item android:drawable="@drawable/part1"/>
   <item android:drawable="@drawable/part2"/>
   <item android:drawable="@drawable/part3"/>
   <item android:drawable="@drawable/part4"/>
</layer-list>

And if the full picture is needed, you can use a fifth (the full) picture, or create it from the parts in a RelativeLayout thus it remains the app light-weight. 而且,如果需要完整图片,则可以使用第五张(完整图片),或者从RelativeLayout中的各个部分创建它,从而使应用程序保持轻量化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM