我使用offsetLeftAndRight把一个TextView移动以后,然后下次再执行比如让TextView字体变大一些的事件后,这个TextView就会自动又回到原来移动前的问题,相当于复位了,请问如何解决这个问题,谢谢!

解决方案 »

  1.   

    处理完再offsetLeftAndRight一下呗
      

  2.   

    ...好吧,那这样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.位置改变后在这个回调中做处理,不然就会出现你的的问题。
      

  3.   

    offsetLeftAndRight should be used only for moving a view temporarily.
      

  4.   

    我解决这个问题了,offsetLeftAndRight 和LS几位大神说的差不多,这个就是一个view的偏移,但是对于layout的VIEW的实际坐标不会造成改变,当整个界面刷新的时候,会重新画,这事就刷回该view的实际坐标了,只有通过setpadding 控制layout实际坐标才能实现你要的效果
      

  5.   

    offsetLeftAndRight方法掉完之后你调用invalidate()方法试试。