<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
  <TextView android:id="@+id/test1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="test1" />
<TextView android:id="@+id/test2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="test2" android:layout_toLeftOf="@id/test1"/>
</RelativeLayout>
这是布局,我通过android:layout_toLeftOf把test2放到了test1左边,然后在test1上应用动画translate ,改变了坐标,但是test2没有一直跟着test1,android:layout_toLeftOf在动画上面没有效果?

解决方案 »

  1.   

    补充一下:移动完以后我是调用Layout来重设坐标,发现相对定位没有效果,但是设置LayoutParameters的MarginLeft来重设坐标,相对定位是有效果的,不过也只是动画结束最后一下,动画移动的过程中test2没有一直跟随
      

  2.   

    用属性动画试试呢?不行干脆就给test2也加个动画两个一起播放