선형 레이아웃을 사용하는 선형 레이아웃이 3 개 있습니다 (정확하게 ImageButton이 있어야 함). 방향이 바뀌면 (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