Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6202995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:50:12+00:00 2026-05-24T04:50:12+00:00

I am currently using ViewFlipper for my main activity with two different layouts. I

  • 0

I am currently using ViewFlipper for my main activity with two different layouts. I want to use a third layout, but I can only find the showNext() and showPrevious() commands. Can someone show me how to implement a third layout using ViewFlipper?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:50:12+00:00Added an answer on May 24, 2026 at 4:50 am

    Made an example for you that shows howto display different views in a ViewFlipper.

    The layout of the example is made up of the following parts. There are three radio buttons. A ViewFlipper is placed below the radio buttons. This flipper holds three different simple views with different texts.

    The radio buttons are then hooked up to a listener in the java code that will change the view displayed by the ViewFlipper depending on which radio button that currently is chosen.

    XML

    <?xml version="1.0" encoding="utf-8"?>
    
    <LinearLayout android:id="@+id/LinearLayout01"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical">
    
        <RadioGroup android:id="@+id/radioGroup1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <RadioButton android:layout_height="wrap_content"
                android:id="@+id/radio0" android:layout_width="wrap_content"
                android:text="Show View 1" android:checked="true"></RadioButton>
            <RadioButton android:layout_height="wrap_content"
                android:id="@+id/radio1" android:layout_width="wrap_content"
                android:text="Show view 2"></RadioButton>
            <RadioButton android:layout_height="wrap_content"
                android:id="@+id/radio2" android:layout_width="wrap_content"
                android:text="Show View 3"></RadioButton>
        </RadioGroup>
    
        <ViewFlipper android:id="@+id/ViewFlipper01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <!--adding views to ViewFlipper-->
            <TextView android:id="@+id/TextView01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="First view is now displayed"></TextView>
            <TextView android:id="@+id/TextView02"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Second view is now displayed"></TextView>
            <TextView android:id="@+id/TextView03"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Third view is now displayed"></TextView>
        </ViewFlipper>
    
    </LinearLayout>
    

    JAVA

    package com.test.threeviews;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.RadioButton;
    import android.widget.ViewFlipper;
    
    public class ThreeViewsinaFlipperActivity extends Activity {
    
        RadioButton RB0;
        RadioButton RB1;
        RadioButton RB2;
        ViewFlipper VF;
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            /*
             * Find the views declared in main.xml.
             */
            RB0 = (RadioButton) findViewById(R.id.radio0);
            RB1 = (RadioButton) findViewById(R.id.radio1);
            RB2 = (RadioButton) findViewById(R.id.radio2);
            VF = (ViewFlipper) findViewById(R.id.ViewFlipper01);
    
            /*
             * Set a listener that will listen for clicks on the radio buttons and
             * perform suitable actions.
             */
            RB0.setOnClickListener(radio_listener);
            RB1.setOnClickListener(radio_listener);
            RB2.setOnClickListener(radio_listener);
        }
    
        /*
         * Define a OnClickListener that will change which view that is displayed by
         * the ViewFlipper
         */
        private OnClickListener radio_listener = new OnClickListener() {
            public void onClick(View v) {
                switch (v.getId()) {
                case R.id.radio0:
                    VF.setDisplayedChild(0);
                    break;
                case R.id.radio1:
                    VF.setDisplayedChild(1);
                    break;
                case R.id.radio2:
                    VF.setDisplayedChild(2);
                    break;
                }
            }
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently using: @^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$ How can i make http:// not compulsory but if it does
I'm currently using the awesome attachment-fu plugin for a Rails app, but as a
Currently using Google Analytics as a supplement to our paid tracking software, but neither
Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control. We have licenses for Telerik. I
Im currently using vs2008 with asp.net mvc framework for web development. Im missing a
I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather
I am currently using Windows Server 2008 Standard and have several Hyper V machines.
I am currently using the following command to upload my site content: scp -r
My company is currently using Sage MAS as their ERP system. While integrating our
I'm currently using DPack as this adds a Collapse All Projects option to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.