微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android-onMeasure,onLayout,OnGlobalLayoutListener之间的区别

我正在做一个非常简单的功能,例如在TextView的末尾添加省略号.

我可以在onMeasure(),onLayout()和OnGlobalLayoutListener()调用添加功能.但是我真的想知道通过实现相同的功能但是用这三种不同的方法有什么区别.
选择这些不同的实现方式是否有偏好或优缺点?

谢谢

解决方法:

尝试遵循this会有所帮助

The layout process consists of two passes, measuring and layouting. A
bit simplified we can say that the measure pass sets how big the view
should be, the dimensions of it, and that the layout pass sets where
to place the view, the position of it. The layout part is only
interesting for views with children, in other words views that
inherits from ViewGroup.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐