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

  • Home
  • SEARCH
  • 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 7569721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:14:15+00:00 2026-05-30T15:14:15+00:00

I am using another list view in place of the image view trying to

  • 0

I am using another list view in place of the image view trying to do 3d transition as given in sample apps.But the List view comes in right of the screen in place of left and words are inverted.my list appears like this:

enter image description here

My code is:

public class EventListActivity extends ListActivity  {

private ListView lv1, lv2;
private ViewGroup mContainer;
private ArrayList<ArrayAdapter<String>> arr;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    super.onCreate(savedInstanceState);
    setContentView(R.layout.eventlist);
    arr = new ArrayList<ArrayAdapter<String>>();
    String[] eventlist = getResources().getStringArray(R.array.eventlist);
    String[] eventlist1 = getResources().getStringArray(R.array.techc);
    String[] eventlist2 = getResources().getStringArray(R.array.presc);
    String[] eventlist3 = getResources().getStringArray(R.array.roboc);
    String[] eventlist4 = getResources().getStringArray(R.array.managec);
    String[] eventlist5 = getResources().getStringArray(R.array.literaryc);
    String[] eventlist6 = getResources().getStringArray(R.array.creationc);
    String[] eventlist7 = getResources().getStringArray(R.array.gamingc);
    ArrayAdapter<String> a1 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist1);
    ArrayAdapter<String> a2 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist2);
    ArrayAdapter<String> a3 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist3);
    ArrayAdapter<String> a4 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist4);
    ArrayAdapter<String> a5 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist5);
    ArrayAdapter<String> a6 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist6);
    ArrayAdapter<String> a7 = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist7);
    arr.add(a1);
    arr.add(a3);
    arr.add(a2);

    arr.add(a4);
    arr.add(a5);
    arr.add(a6);
    arr.add(a7);
    final ArrayAdapter<String> a = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, eventlist);
    lv1 = getListView();
    lv2 = (ListView) findViewById(R.id.list2);
    mContainer = (ViewGroup) findViewById(R.id.container);
    lv1.setAdapter(a);
    lv2.setClickable(true);
    lv2.setFocusable(true);
    mContainer
            .setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);
    lv1.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
            // TODO Auto-generated method stub
            lv2.setAdapter(arr.get(arg2));

            applyRotation(arg2, 0, 90);

        }
    });

}

protected void applyRotation(int position, int start, int end) {
    // TODO Auto-generated method stub
    final float centerX = mContainer.getWidth() / 2.0f;
    final float centerY = mContainer.getHeight() / 2.0f;

    // Create a new 3D rotation with the supplied parameter
    // The animation listener is used to trigger the next animation
    final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end,
            centerX, centerY, 310.0f, true);
    rotation.setDuration(500);
    rotation.setFillAfter(true);
    rotation.setInterpolator(new AccelerateInterpolator());
    rotation.setAnimationListener(new DisplayNextView(position));

    mContainer.startAnimation(rotation);
}

private final class DisplayNextView implements Animation.AnimationListener {
    private final int mPosition;

    private DisplayNextView(int position) {
        mPosition = position;
    }

    public void onAnimationStart(Animation animation) {
    }

    public void onAnimationEnd(Animation animation) {
        mContainer.post(new SwapViews(mPosition));
    }

    public void onAnimationRepeat(Animation animation) {
    }
}

/**
 * This class is responsible for swapping the views and start the second
 * half of the animation.
 */
private final class SwapViews implements Runnable {
    private final int mPosition;

    public SwapViews(int position) {
        mPosition = position;
    }

    public void run() {
        final float centerX = mContainer.getWidth() / 2.0f;
        final float centerY = mContainer.getHeight() / 2.0f;
        Rotate3dAnimation rotation;

        if (mPosition > -1) {
            lv1.setVisibility(View.GONE);
            lv2.setVisibility(View.VISIBLE);
            lv2.requestFocus();

            rotation = new Rotate3dAnimation(90, 180, centerX, centerY,
                    310.0f, false);
        } else {
            lv2.setVisibility(View.GONE);
            lv1.setVisibility(View.VISIBLE);
            lv1.requestFocus();

            rotation = new Rotate3dAnimation(90, 0, centerX, centerY,
                    310.0f, false);
        }

        rotation.setDuration(500);
        rotation.setFillAfter(true);
        rotation.setInterpolator(new DecelerateInterpolator());

        mContainer.startAnimation(rotation);
    }
}}

My xml code is `

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layoutAnimation="@anim/layout_bottom_to_top_slide"
    android:persistentDrawingCache="animation|scrolling" />

<ListView
    android:id="@+id/list2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:scaleType="fitCenter"
    android:visibility="gone" />

`

How can i get the list view in right position?

  • 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-30T15:14:16+00:00Added an answer on May 30, 2026 at 3:14 pm

    You are probably rotating it to 180 degrees which results in backwards list

    What you need is to rotate to 360 degrees. While this will result in more “spinnings” you can fake that by following:

    Rotate list to 90 degrees. While list is turned 90 degrees we can’t see it and you can replace your list with new one.
    Then in AnimationListener.onAnimationEnd() you just animate list one more time from 270 to 360:

    Rotate3dAnimation rotation = new Rotate3dAnimation(270, 360, centerX, centerY, 60.0f, false);
    

    without listening to its end.

    Full onAnimationEnd:

    public void onAnimationEnd(Animation animation) {       
        // RENDER YOUR NEW LIST HERE
    
        final float centerX = mContainer.getWidth() / 2.0f;
           final float centerY = mContainer.getHeight() / 2.0f;
    
           Rotate3dAnimation rotation = new Rotate3dAnimation(270, 360, centerX, centerY, 60.0f, false);
    
        rotation.setDuration(500);
        rotation.setFillAfter(true);
        rotation.setInterpolator(new AccelerateInterpolator());
        mContainer.startAnimation(rotation);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am creating a List View in another List View using this code
I'm using a view that supports list inside another list. I want to multi-thread
I'm trying to parse a string that was generated by an NSDateFormatter using another
I am trying to open one window from another using makeKeyAndOrderFront. The new window
I'm trying to load one page into another using the .load() method. This loaded
How can I subtract one image from another using openCV? Ps.: I coudn't use
I have a list view that is displaying data using the gridview. This list
We have created custom listview by using the Base adapter. List view contains Text
My form has lookup column which gets data from another list but I want
I am using printDocument to print from a list view. This all works fine.

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.