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 6558725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:14:06+00:00 2026-05-25T13:14:06+00:00

I am trying to get swipe gestures working with a tab layout in an

  • 0

I am trying to get swipe gestures working with a tab layout in an android app. What I am working with is a single activity with a different view for each tab. Rather than having them contained in a FrameLayout, I am using a ViewFlipper for my tab content. I want to make left/right swipe gestures change the active tabs the active tab to the one to the left or right of the current one.

The problem arises when swiping to and from my third list after items have been added to it. I’m seeing a behavior where the third list is displayed, but is overlaid on the list I was on previously.

Any ideas why this is happening?

My java code for switching views/tabs:

public void onSwipe(int direction) {     
    switch (direction) {     
        case SimpleGestureFilter.SWIPE_RIGHT : swipeRight(); break;
        case SimpleGestureFilter.SWIPE_LEFT :  swipeLeft(); break;
    }    
}

private void swipeLeft() {  

    viewFlipper.setInAnimation(this,R.anim.slide_in_right);
    viewFlipper.setOutAnimation(this,R.anim.slide_out_left);
    viewFlipper.showNext();
    tabHost.setCurrentTab( (tabHost.getCurrentTab()+1 ) % NUMTABS );
}

private void swipeRight() {

    viewFlipper.setInAnimation(this, android.R.anim.slide_in_left); 
    viewFlipper.setOutAnimation(this,android.R.anim.slide_out_right);
    viewFlipper.showPrevious();
    tabHost.setCurrentTab( (tabHost.getCurrentTab()+(NUMTABS-1) ) % NUMTABS ); //loop around to avoid -1
}

My layout:

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />
    <ViewFlipper
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/tabs"
        android:layout_above="@+id/search_button"
        android:padding="5dp" >          
         <ListView android:id="@+id/list1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:choiceMode="multipleChoice"
          android:layout_alignParentTop="true"
          android:textFilterEnabled="true"/>

         <ListView android:id="@+id/list2"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:choiceMode="multipleChoice"
          android:layout_alignParentTop="true"
          android:textFilterEnabled="true"/>


         <ListView android:id="@+id/list3"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" 
          android:layout_alignParentTop="true"/>


     </ViewFlipper>
     <Button android:id="@+id/search_button"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:text="Search" />

</RelativeLayout>

  • 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-25T13:14:06+00:00Added an answer on May 25, 2026 at 1:14 pm

    This is now supported out of the box in the Android SDK compatibility libs: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?m=1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get a section on my site working when it basically acts in
Trying to get radiobuttons binding working but getting a run time error with the
Im trying to figure out how apps like swipe pad ( https://market.android.com/details?id=mobi.conduction.swipepad.android ) can
I'm trying to find a way to swipe images in my android application.I find
I'm trying to recognize left/right swipe gesture in a UIScrollView . I've tried to
I am trying get all local machine services. But why are some services missing
http://lxr.linux.no/linux+v2.6.35/include/linux/preempt.h#L21 I am just trying get the linux source. I saw this preempt count
Trying to get this to function, randomly chooses 1 of the 3 color choices.
Trying to get jQuery to detect enter input, but space and other keys are
I am trying to find any examples on how to code jquery mobile swipe

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.