English 中文(简体)
图像观察.setImageBitmap (Bitmap) 放慢了我的 app。
原标题:imageView.setImageBitmap(Bitmap) slows my app extremly

i) 写了一条灯片,显示一只ta子,能够从蓝色到洋上获得有关石灰的数据。 当数据变化时,即更换针头和其他图像 在屏幕上显示现有数值的意见。

轮值代码:

bMapRpm=bMapcanvasBackTacho.copy(bMapcanvasBackTacho.getConfig(), true);
canvasRpm.setBitmap(bMapRpm);
canvasRpm.save();
canvasRpm.rotate((float)Rpmdegree+(float)Rpmcurrentdegree,bMapRpm.getWidth()/2,bMapRpm.getHeight()/2);
canvasRpm.drawBitmap(bMapNadel,0,0,paint);
canvasRpm.restore();

bMapcanvasBackTacho is just a transparent background. bMapNadel is the bitmap of the needle. bMapRpm is the bitmap of the canvas to draw on

更新形象 观点一:

ivNadel.setImageBitmap(bMapRpm);

i tryed out what slows the app by commenting parts of the code out. after commenting the setImageBitmap() out the slow down disapeared.

谁知道如何更新形象 另一种方式或轮式的观念可能会改变,使其更快地工作?

thx =

问题回答

You can do two things:
First, don t call copy() each time you need to update the Bitmap this creates a new Bitmap and is both time and memory consuming.
Second, call invalidate() on the ImageView. This will notify the View that something has changed and it redraws itself without having to update anything else that is happening when you replace the Bitmap completely.

最后,你甚至可能想建立你自己。 观点执行,使你只能凌驾于<条码>onDraw(<>/条码>,并在那里进行轮换。





相关问题
How to start to create an application GUI using C#?

HI! I am new to C# and plan to use it for my application GUI. I am trying to make my GUI similar to SPSS:http://www.spss.com/images/08/statistics_screens/ez_rfm-big.jpg Is this easy in C#? Is there ...

Automatic height of edit box

My shoes application has three items stacked on top of each other (with a stack, of course), in order: A banner An edit box Two buttons in a flow What I want to do is have the banner stay at it s ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

UI And TcpClient Issue in vb.net

I m having some problems with a small ircbot i m writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text ...

UI Convention: Shortcut key for application exit? [closed]

Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is ...

热门标签