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

offsetLeftAndRight的问题

我使用offsetLeftAndRight把一个TextView移动以后,然后下次再执行比如让TextView字体变大一些的事件后,这个TextView就会自动又回到原来移动前的问题,相当于复位了,请问如何解决这个问题,谢谢! --------------------编程问答-------------------- 处理完再offsetLeftAndRight一下呗 --------------------编程问答-------------------- 大哥,那样搞就穿帮了 .要求在原来位置字体变大. --------------------编程问答-------------------- ...好吧,那这样

protected void onLayout (boolean changed, int left, int top, int right, int bottom)

Since: API Level 1
Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their their children.

位置改变后在这个回调中做处理,不然就会出现你的的问题。 --------------------编程问答-------------------- offsetLeftAndRight should be used only for moving a view temporarily. --------------------编程问答-------------------- 请问LZ解决了吗?
我也遇到相同的问题了 --------------------编程问答-------------------- 我解决这个问题了,offsetLeftAndRight 和LS几位大神说的差不多,这个就是一个view的偏移,但是对于layout的VIEW的实际坐标不会造成改变,当整个界面刷新的时候,会重新画,这事就刷回该view的实际坐标了,只有通过setpadding 控制layout实际坐标才能实现你要的效果 --------------------编程问答-------------------- 我是因为楼主的敬业忍不住回复下的,现在很多人解决问题后都不愿意或没意识要分享下结果的。
鼓掌... --------------------编程问答-------------------- offsetLeftAndRight方法掉完之后你调用invalidate()方法试试。
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,