0
这是我个XML(基本上有两种观点:内部的线性[B
]相对[A
])设置视图的宽度大于父视图的宽度?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/A"
android:layout_width= "wrap_content"
android:layout_height= "wrap_content" >
<LinearLayout
android:id="@+id/B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
</<RelativeLayout>
我设置的w*10
屏幕宽度的B
10倍,即宽度:
RelativeLayout.LayoutParams para = new RelativeLayout.LayoutParams(w*10, h);
B.setLayoutParams(para);
当我动画B
,
ObjectAnimator animation2 = ObjectAnimator.ofFloat(B, "x", -w)
它显示B
的宽度是w
而不是w*10
,好像A
正在作为父视图,它正在限制其宽度。
我应该怎么做B
的宽度为w*10
?
试过了'A.requestLayout()',但它仍然没有包装'B' .. –