view的requestLayout()方法

来源:互联网 发布:linux 变量连接字符串 编辑:程序博客网 时间:2024/05/21 11:20

public void requestLayout ()

Since: API Level 1

Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree.

 

我们可以理解为重新布局了一下view;


用途:有时我们在改变一个view 的内容之后 可能会造成显示出现错误,比如写ListView的时候 重用convertview中的某个TextView 可能因为前后填入的text长度不同而造成显示出错,此时我们可以在改变内容之后调用requestLayout方法加以解决。