Я хочу прокрутить между двумя линейными макетами, которые завернуты в макет рамки. В свое время видна только одна из линейных макетов. Я использую кнопку, чтобы показать/скрыть их. Я хочу реализовать в них функции салфетки. Я пробовал ViewFliper, но не работал на пальцах. Можно ли это сделать с помощью ViewPager?Проведите между двумя макетами, наложенными друг на друга в Framelayout
Layout XML является
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000" >
<LinearLayout
android:id="@+id/layTopUp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/yellowspace"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:padding="25dp"
android:visibility="visible" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="XXX"
android:textColor="#000000" />
<Spinner
android:id="@+id/spnTopupOperator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="XXX"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical|center_horizontal" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="XXX"
android:textColor="#000000" />
<EditText
android:id="@+id/etTopUpCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="3"
android:hint="Code"
android:inputType="number"
android:maxLength="3" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/etTopUpNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="7"
android:hint="Number"
android:inputType="number"
android:maxLength="7"
android:shadowColor="#000000" />
</LinearLayout>
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="XXX"
android:textColor="#000000" />
<Spinner
android:id="@+id/spnTopupAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
<LinearLayout
android:id="@+id/layConv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="@+id/tvConvertedAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:text="XXX "
android:textColor="#000000" />
<ProgressBar
android:id="@+id/pbConversion"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>
<ImageButton
android:id="@+id/bTopUpSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:background="@drawable/sendrechbotton" />
</LinearLayout>
<LinearLayout
android:id="@+id/layScratchCard"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/yellowspace"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:padding="25dp"
android:visibility="gone" >
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="XXXX"
android:textColor="#000000" />
<Spinner
android:id="@+id/spnRechargeOperator"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="XXX"
android:textColor="#000000" />
<EditText
android:id="@+id/etRechargeEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Email"
android:inputType="textEmailAddress" />
<TextView
android:id="@+id/textView8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="XXXX"
android:textColor="#000000" />
<Spinner
android:id="@+id/spnRechargeAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/bSendCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sendcardbotton" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
Да, вы можете создать два фрагмента и поместить их в адаптер для Viewpager. – Anukool