首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

【Android】: TextView控件:setWith,getWith,setMaxWith不起作用,该如何处理

2012-06-11 
【Android】: TextView控件:setWith,getWith,setMaxWith不起作用大家好:有空时帮看下请教下TextView中的setW

【Android】: TextView控件:setWith,getWith,setMaxWith不起作用
大家好:有空时帮看下
请教下TextView中的setWith为什么不起作用,就是getWith始终获得为0,但是在单击事件中(单击事件外设置setWith,单击事件里调用getWith获得)可以的;
还有就是在单击事件中(里面或外面设置setMaxWith,里面调用getWith获得)得到的值均不正确的

多谢~

[解决办法]
在你整个view没有初始化结束显示出之前 貌似getWidth是得不到的
[解决办法]
换getMeasuredWidth() and getMeasuredHeight().看看。。

Use getWidth() to see how wide a view is after layout.

热点排行