Android中postinvalidate和validate的区别
2015-06-05 00:59
507 查看
1. 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 event loop on the UIThread as soon as possible. It is also briefly
explained in the SDK documentation.
2.
By this method (
you can invalidate a
non-UI threads. To invalidate a
UI-thread use
The invalidation means, that the
will we called at some point in the future (not immediately) to redraw whole
the
visible).
Android is redrawing
automaticly, but sometimes is necessary to tell: "Hey, this
been changed, redraw it as fast as possible."
More at:
http://developer.android.com/guide/topics/ui/how-android-draws.html
http://developer.android.com/reference/android/view/View.html#invalidate%28%29
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 event loop on the UIThread as soon as possible. It is also briefly
explained in the SDK documentation.
2.
By this method (
postInvalidate()),
you can invalidate a
Viewfrom
non-UI threads. To invalidate a
Viewfrom
UI-thread use
invalidate()method.
The invalidation means, that the
View.onDraw(Canvas)method
will we called at some point in the future (not immediately) to redraw whole
View(if
the
Viewis
visible).
Android is redrawing
Views
automaticly, but sometimes is necessary to tell: "Hey, this
Viewhas
been changed, redraw it as fast as possible."
More at:
http://developer.android.com/guide/topics/ui/how-android-draws.html
http://developer.android.com/reference/android/view/View.html#invalidate%28%29
相关文章推荐
- Developing for Android, II The Rules: Memory
- Android中ArrayAdapter在自动提示文本中的使用
- Android中visibility属性VISIBLE、INVISIBLE、GONE的区别
- Android编码规范
- Android 数据库打包随APK发布
- Android 开发中,如何将 SQLite 和 APK 一起打包发布
- ANDROID开发:将数据库文件与项目包一起打包成APK文件
- Developing for Android, I: Understanding the Mobile Context
- Android 踏雷日記(2)更優雅地解決 String Out Of Memory
- Android 踏雷日記(1)String Out Of Memory
- android内存管理工具MAT的使用
- Android 编程下的 TraceView 简介及其案例实战
- Android development guide 笔记
- 疯狂android讲义笔记
- 菜鸟学Android笔记(二十二):Servlet的一些细节
- Android 手机间的文件传送(socket手机做服务端和客户端进行)
- android开发之播放音乐的方法
- android中adb命令大全
- Android开发,如何成功将默认的图标换成自己设置的
- Android之数据存储(一)