Tôi muốn đổi kích thước một số bố cục trong Hoạt động của mình.Thay đổi kích thước bố cục theo chương trình (dưới dạng hoạt ảnh)
Đây là mã của XML chính:
<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>
Như bạn có thể thấy, phía trên và bố trí phía dưới chiều cao là 0, và giữa bố trí bao gồm tất cả các nơi.
Tôi muốn giảm kích thước bố cục ở giữa theo chương trình, đồng thời tăng cả hai kích thước đầu trang và bố cục dưới cùng cho đến khi tất cả bố cục có cùng chiều cao.
Tôi muốn nó trông giống như hoạt ảnh.
Tôi nên làm như thế nào?
Cảm ơn
Tôi nghĩ đây là một giải pháp tuyệt vời (http://stackoverflow.com/a/13381228/1276636). – Sufian
Tôi đoán bạn cần ghi đè 'public void initialize' &' public boolean willChangeBounds'. –
Cảm ơn bạn rất nhiều! –