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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:42:47+00:00 2026-05-28T03:42:47+00:00

I want to include a simple animation in my app where a view widget

  • 0

I want to include a simple animation in my app where a view widget moves to another view widget.

The code I have written is:

TranslateAnimation animate = new TranslateAnimation(view1.getTranslationX(), view1.getTranslationY(), view2.getTranslationX(), view2.getTranlationY());
animate.setDuration(500);
view1.startAnimation(animate);

The problem is that view1 is a custom view inherited from ViewSwitcher whereas view2 is a Button. getTranslation() gives no such method exception for both.

How can I get the view’s position on screen and is this the right way to do the animation ?

Note: The ViewSwitcher is part of a ListView item so it also needs to cross over its ListView boundary to get to the Button(just in case that makes a difference).

  • 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-28T03:42:48+00:00Added an answer on May 28, 2026 at 3:42 am

    Methods like getTranslationX() and getTranslationY() simply return an offset value that may be applied to the actual view position, and not the position itself. You will want to use methods like getLeft() and getTop() to get the x/y position value of a view relative to its parent (in this case, the ListView).

    If you need more global coordinates, use getLocationInWindow() or getLocationOnScreen() to get the view’s position relative to the global display hierarchy. These methods do not return the position, but rather fill it into the int[] you provide as a parameter.

    All of these methods can be called on any View.

    HTH

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

Sidebar

Related Questions

I have a simple class I want to include in my Rails app, but
I have written this code which is simple #include <stdio.h> #include <string.h> void printLastLetter(char
i want to do this simple piece of code work. #include <iostream> #include <windows.h>
I have some simple OO code I've written that I'm playing with: //define a
I want to include a link in my SiteMaster (using Html.ActionLink) UNLESS the view
I want to send data to an API. The data include simple variables: username,
I've got an a simple include for my new project. What happens is my
I'm writing a small Python app for distribution. I need to include simple XML
So, I essentially have what I want already, very simple, but there are some
I want include the Type name of each object in my collection from my

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.