I am attempting to add multiple TextView to a ViewFlipper through the Manifest.
This is what I have done:
<ViewFlipper
android:id="@+id/phrase_flipper"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.abc.utils.AutoResizeTextView
android:id="@+id/instruction_context"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="This Is Screen 1"
android:layout_gravity="top|center_horizontal"
android:layout_marginLeft="@dimen/card_margin"
android:layout_marginRight="@dimen/card_margin"
android:background="@android:color/holo_green_light"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<com.abc.utils.AutoResizeTextView
android:id="@+id/phrase_primary"
android:layout_width="wrap_content"
android:layout_height= "190dp"
android:layout_marginLeft="@dimen/card_margin"
android:layout_marginRight="@dimen/card_margin"
android:background="@android:color/holo_green_light"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</ViewFlipper>
However, when doing so, it is interpreted as "instruction_context" being shown on even views and phrase_primary on odd views.
Is there a way around that?
Thank you!
FYI that's not a manifest, it is just an xml resource file.
Try containing your TextViews in a ViewGroup, which ViewFlipper should hopefully treat as a single View:
<ViewFlipper
android:id="@+id/phrase_flipper"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.abc.utils.AutoResizeTextView
android:id="@+id/instruction_context"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="This Is Screen 1"
android:layout_gravity="top|center_horizontal"
android:layout_marginLeft="@dimen/card_margin"
android:layout_marginRight="@dimen/card_margin"
android:background="@android:color/holo_green_light"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<com.abc.utils.AutoResizeTextView
android:id="@+id/phrase_primary"
android:layout_width="wrap_content"
android:layout_height= "190dp"
android:layout_marginLeft="@dimen/card_margin"
android:layout_marginRight="@dimen/card_margin"
android:background="@android:color/holo_green_light"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</LinearLayout>
</ViewFlipper>