当前位置:编程学习 > wap >>

Android 画直线中getMeasuredHeight()和getMeasuredWidth()获得的是什么值?

请问精通Android开发的大侠谁知道画直线的getMeasuredHeight()和getMeasuredWidth()是获得什么值呢 ?
有谁看过Android高级编程的这本书,我在书本中提供的网站(http://www.wrox.com)下载的源代码都有错误的。请问哪里有得下载正确的源代码呢?
书上的例子todolist有哪位高人正确的在模拟机上运行了呢??或者有代码也可以发给小弟参考下,可否。
本人QQ:659276192
不胜感激!! --------------------编程问答-------------------- getMeasuredHeight
getMeasuredWidth
是获取view的宽高 --------------------编程问答--------------------
引用 1 楼 dinjay 的回复:
getMeasuredHeight
getMeasuredWidth
是获取view的宽高

那getHeight和getWidth是获得谁的宽高? --------------------编程问答-------------------- 看sdk:
public final int getMeasuredHeight ()

Since: API Level 1
The height of this view as measured in the most recent call to measure(). This should be used during measurement and layout calculations only. Use getHeight() to see how tall a view is after layout.

这个函数是在你调用measure之后计算出的高度,如果你layout变化了,也就是size变了,需要通过measure来重新计算view的高度,计算完后,getMeasuredHeight和getHeight这时是一样的。步骤上有区别 --------------------编程问答--------------------
引用 3 楼 dinjay 的回复:
看sdk:
public final int getMeasuredHeight ()

Since: API Level 1
The height of this view as measured in the most recent call to measure(). This should be used during measurement and layout calcula……

这个视图的高度在最近的一个测量叫来衡量()。这应该是用在测量和布局的计算只。(使用)去看getHeight多么高的观点是后的布局。
有点明白了,能给点例子么?
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,