3
我有一個垂直取向的的LinearLayout,該佈局內我有三個按鈕(ImageButtons是精確的),並且當我已經將它們設置的取向變化(通過OrientationEventListener)執行旋轉動畫。頂部和底部按鈕可以完美旋轉,但中間的按鈕不會。它的樞軸點似乎是關閉的。在的LinearLayout問題旋轉視圖
這裏是動畫的佈局:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="-90"
android:pivotX="50%"
android:pivotY="50%"
android:duration="500"/>
...這裏是我如何啓動動畫:
Animation rotate = AnimationUtils.loadAnimation(this.mContext, animResId);
rotate.setFillEnabled(true);
rotate.setFillAfter(true);
{...retrieve the each ImageButton then call startAnimation(rotate) on them...}
...這裏是在組件佈局我的活動,這是我的菜單LinearLayout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/camera_menu"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/camera_preview"
android:layout_alignParentRight="true"
>
<ImageButton
android:id="@+id/camera_top_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
android:src="@drawable/placeholder"
android:scaleType="centerInside"
android:onClick="onTopButtonClick"
/>
<ImageButton
android:id="@+id/camera_action_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:src="@drawable/placeholder"
android:scaleType="centerInside"
android:onClick="onActionButtonClick"
/>
<ImageButton
android:id="@+id/camera_bottom_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
android:src="@drawable/placeholder"
android:scaleType="centerInside"
android:onClick="onBottomButtonClick"
/>
</LinearLayout>
有沒有人有一個想法,爲什麼中間(行動)按鈕沒有圍繞正確的樞軸點旋轉?
有一兩件事我注意到的是,旋轉後,中間的按鈕與其他兩個的頂部,小按鈕(在頂部和底部的按鈕)對齊。
在此先感謝您的幫助!
問候,celestialorb。
我遇到麻煩支點以及。我開始懷疑這是一個錯誤。你有沒有解決這個問題? – Thomas 2011-01-25 18:31:57