1

私はフリッピングUI画面を開発しています。「android.view.animation.Animation」クラスを使用して、onClickでは正常に動作していますが、ontouchでは動作しません。これが私のコードです

 Animation cardTwoAnimation = cardTwoAnimation = new RotateAnimation(-100f, -180f,
 Animation.RELATIVE_TO_SELF, 0.5f, Animation.ABSOLUTE, 1);

 cardTwoAnimation.setDuration(1000); 
 cardTwoAnimation.setRepeatCount(0); 
 cardTwoAnimation.setRepeatMode(Animation.ZORDER_TOP); 
 cardTwoAnimation.setFillAfter(true);
 fmbCardLayoutTwo.setAnimation(cardTwoAnimation);

onTouch では、同じメソッドを使用してこれらのレイアウトを回転させています。相対レイアウト内に 3 つの線形レイアウトがあり、onTouch メソッドを呼び出していますが、問題は画面にアニメーションを表示していません (すべての system.out ステートメントが 1 行ずつ実行されています)。

<RelativeLayout
            android:id="@+id/fmb_asker_questions_relative_layout"
            android:layout_width="wrap_content"
            android:layout_height="170dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:clickable="true" >

            <LinearLayout
                android:id="@+id/question_card_two_linear_layout"
                android:layout_width="110dp"
                android:layout_height="150dp"           
                android:layout_marginBottom="196dp"
                android:layout_marginLeft="90dp"
                android:layout_marginTop="160dp"
                android:background="@drawable/fmb_asker_card_style"
                android:orientation="vertical" >                             

            </LinearLayout>

            <LinearLayout
                android:id="@+id/question_card_one_linear_layout"
                android:layout_width="110dp"
                android:layout_height="150dp"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="196dp"
                android:layout_marginLeft="90dp"
                android:layout_marginTop="160dp"
                android:background="@drawable/fmb_asker_card_style"
                android:clickable="true"
                android:orientation="vertical" >            

            </LinearLayout>

            <LinearLayout
                android:id="@+id/question_card_three_linear_layout"
                android:layout_width="110dp"
                android:layout_height="150dp"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="196dp"
                android:layout_marginLeft="90dp"
                android:layout_marginTop="160dp"
                android:background="@drawable/fmb_asker_card_style"
                android:orientation="vertical" >

            </LinearLayout>

            <LinearLayout
                android:id="@+id/fmb_ascker_question_card_submit_button"
                android:layout_width="110dp"
                android:layout_height="120dp"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="196dp"
                android:layout_marginLeft="90dp"
                android:layout_marginTop="100dp"
                android:background="@drawable/fmb_asker_fliping_submit_button_style"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="25dp"
                    android:text="SELECT"
                    android:textSize="20dp"
                    android:textColor="#ffffff"
                    android:textStyle="bold" />
            </LinearLayout>

            <Button
                android:id="@+id/button_right"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="15dp"
                android:text="Right" />

            <Button
                android:id="@+id/button_left"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/button_right"
                android:layout_alignBottom="@+id/button_right"
                android:layout_alignLeft="@+id/layout2"
                android:text="Left" />
        </RelativeLayout>
4

1 に答える 1

0

RelativeLayout の代わりに LinearLayout を試してください。

于 2012-09-26T18:08:29.380 に答える