Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use a view flipper, for example</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ViewFlipper android:id="@+id/viewflipper" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:id="@+id/page_1" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;!-- Put stuff for page 1 --&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/page_2" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="INVISIBLE"&gt; &lt;!-- Put stuff for page 2 --&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/page_3" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="INVISIBLE"&gt; &lt;!-- Put stuff for page 3 --&gt; &lt;/LinearLayout&gt; &lt;!-- ... --&gt; &lt;LinearLayout android:id="@+id/page_N" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="INVISIBLE"&gt; &lt;!-- Put stuff for page N --&gt; &lt;/LinearLayout&gt; &lt;/ViewFlipper&gt; &lt;/FrameLayout&gt; </code></pre> <p>Now to flip between the different views, you would (in your java file) </p> <pre><code>ViewFlipper flipper = (ViewFlipper) findViewById(R.id.viewflipper); flipper.setInAnimation(AnimationUtils.loadAnimation(mContext, R.anim.exit_slide_right_left)); flipper.setOutAnimation(AnimationUtils.loadAnimation(mContext,R.anim.enter_slide_right_left)); flipper.setDisplayedChild(n); </code></pre> <p>which will slide as if you're flipping forward, the animation file looks like:</p> <p>(enter_slide_right_left.xml)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"&gt; &lt;translate android:fromXDelta="0%" android:toXDelta="-100%" android:fromYDelta="0%" android:toYDelta="0%" android:duration="700"/&gt; &lt;/set&gt; </code></pre> <p>and (exit_slide_right_left.xml)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"&gt; &lt;translate android:fromXDelta="100%" android:toXDelta="0%" android:fromYDelta="0%" android:toYDelta="0%" android:duration="700" /&gt; &lt;/set&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload