安卓:帆布动态更改位图的Z指数 [英] Android:Canvas Dynamically change a bitmap's z-index

查看:69
本文介绍了安卓:帆布动态更改位图的Z指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个Android应用程序,并在我的应用程序我有我画无数位图通过canvas.drawBitmap()函数在画布画布。从我的理解对这些位图的z-index为基础,在它们被画到画布上的顺序设置。绘制这些位图,如果我可以动态改变一个位图的z-index把它推到顶部后,我试图找出是?这似乎是一个很简单的问题,但我有没有运气找到解决办法呢。

I am creating an Android app and in my app I have a canvas which I draw numerous bitmaps to the canvas via the canvas.drawBitmap() function. From my understanding the z-index on these bitmaps are set based on the order in which they are being drawn to the canvas. What I am trying to figure out is after drawing these bitmaps if I can dynamically change the z-index on a bitmap to push it to the top? This seems like a very simple problem, but I have had not luck in finding a solution yet.

在此先感谢, 布罗迪·史密斯

Thanks in advance, Brody Smith

推荐答案

不是真的有可能:你叫后 drawBitmap 位图的内容呈现到画布上,但画布不存储任何引用原始位图,它只存储应用位图的内容到画布的结果。有没有办法来动态要说的位图,你画了第一出50,我要你做的第50位,并自动重绘每一个等位图以反映更改的。

Not really possible: after you call drawBitmap the contents of the bitmap are rendered onto the canvas, but the canvas does not store any references to the original bitmap, it only stores the results of applying the bitmap's contents to the canvas. There is no way to dynamically say that bitmap you drew 1st out of 50, I want you to make that the 50th bitmap and automatically redraw every single other bitmap to reflect the change.

所以,你需要用手之前订购的绘制操作。

So you'll need to order your drawing operations before hand.

这篇关于安卓:帆布动态更改位图的Z指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆