선다형 문제를 연습하는 교육용 응용 프로그램을 만들고 있습니다. 저는 두 가지 질문 사이에서 슬라이드 애니메이션을하고 싶습니다. 사용자가 하나의 질문에 올바르게 대답하면, 새로운 질문이 오른쪽에서부터 시작하는 동안 왼쪽으로 밀려납니다. 같은 유형의보기간에 애니메이션을 수정하는 올바른 방법은 무엇입니까?
현재, 내 질문/대답 레이아웃이 (question.xml)과 같습니다<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:id="@+id/question"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="8pt"
android:textStyle="bold"
android:layout_margin="5px"
android:layout_marginBottom="10dp"
android:clickable="true"
/>
<RadioGroup android:id="@+id/answers"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="5px"
>
<RadioButton android:id="@+id/answer_a"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="7pt"
android:layout_margin="5dp"
android:layout_marginBottom="10dp"
/>
<RadioButton android:id="@+id/answer_b"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="7pt"
android:layout_margin="5dp"
android:layout_marginBottom="10dp"
/>
<RadioButton android:id="@+id/answer_c"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="7pt"
android:layout_margin="5dp"
android:layout_marginBottom="10dp"
/>
</RadioGroup>
</LinearLayout>
</ScrollView>
질문에 대답하고 대답을 평가 한 후, 난 그냥 질문의 텍스트와 세 가지 답변을 변경했습니다. 꽤 직설적 인.
지금, 나는 애니메이션을 할 ViewFlipper를 사용하여 시도했다 :
<ViewFlipper android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<include android:id="@+id/current_view" layout="@layout/question" />
<include android:id="@+id/next_view" layout="@layout/question" />
</ViewFlipper>
하지만 그 방법은 내가 findViewById
를 통해 별도로 현재 및 다음 문제의보기에 액세스 할 수 없습니다.
이렇게하려면 서로 다른 ID로 동일한 질문 레이아웃을 두어야합니까? 그것은 나에게 불필요한 것처럼 보입니다. 또는 에만 액세스 할 수있는 또 다른 방법이 있습니까 질문 & 두 번째보기에서 대답하나요?
또는이를 수행하는 더 쉬운 방법이 있습니까?
감사합니다.