我想在我的活动中调整一些布局的大小。以编程方式调整布局的大小(作为动画)
下面是主要的XML代码:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/top"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#3ee3e3" >
</LinearLayout>
<LinearLayout
android:id="@+id/middle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:id="@+id/bottom"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#fe51e6" >
</LinearLayout>
</LinearLayout>
正如你可以看到,顶部和底部的布局高度的是0,中间 布局覆盖了所有的地方。
我想以编程方式减少中间布局大小,同时增加顶部 和底部布局大小,直到所有布局具有相同的高度。
我希望它看起来像动画。
我该怎么做?
谢谢
我认为这是一个很棒的[解决方案](http://stackoverflow.com/a/13381228/1276636)。 – Sufian
我想你也需要重写'public void initialize'&'public boolean willChangeBounds'。 –
非常感谢! –