什么是postInvalidate()呢? [英] What does postInvalidate() do?

查看:130
本文介绍了什么是postInvalidate()呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是使用Android中的 postInvalidate()的功能?我已经看到这个功能在很多地方。当我用Google搜索,我想出了这么多的:

What is the use of the postInvalidate() function in Android? I have been seeing this function in a lot of places. When I Googled, I came out with this much:

postInvalidate--的发布UI线程在一个无效的请求

postInvalidate-- post an invalidate request on the UI-thread

我不知道是什么的那句无效的请求有指。能详细这里发生了什么有人解释?

I don't know what the phrase "invalidate request" there means. Can someone explain in detail what is happening here?

推荐答案

这是从View类派生每个类都有在无效 postInvalidate 方式。如果无效被调用它告诉,目前来看已经修改了系统,并应尽快重新绘制。由于这种方法只能从UIThread被称为另一种方法是在需要的时候你是不是在UIThread,仍然要通知你的观点已经被更改系统。所述postInvalidate方法从非UIThread通知系统和View得到尽快重新绘制在对UIThread下一事件循环。它也是<一个href="http://developer.android.com/reference/android/view/View.html#postInvalidate%28int,%20int,%20int,%20int%29">briefly在SDK文档中解释。

Each class which is derived from the View class has the invalidate and the postInvalidate method. If invalidate gets called it tells the system that the current view has changed and it should be redrawn as soon as possible. As this method can only be called from your UIThread another method is needed for when you are not in the UIThread and still want to notify the system that your View has been changed. The postInvalidate method notifies the system from a non-UIThread and the View gets redrawn in the next eventloop on the UIThread as soon as possible. It is also briefly explained in the SDK documentation.

只是比较无效 postInvalidate

这篇关于什么是postInvalidate()呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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