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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:08:44+00:00 2026-05-27T03:08:44+00:00

I have a problem which bothers me for some time. I have an imageView

  • 0

I have a problem which bothers me for some time.

I have an imageView that I animate (move, scale and rotate on the X and Y axises) and it is inside a RelativeLayout. My animation is supposed to flip the imageView and scale it so that it will fill the screen with the imageView’s back-side solid color. Imagine something like having a sticker that has a solid grey color on its back side and that I want to be able to see this solid color when I flip the sticker.

The problem is that whatever I do, I can’t see that solid color.

I tried setting the background color of the imageView but it didn’t work.
I tried creating another Layout inside the parent Relativelayout and then setting the Layout’s background color, but it didn’t work.
I tried setting the background color of the parent RelativeLayout, but it didn’t work.

I am kinda stuck so I would really aprreciate any help or ideas that you can provide.

Thanks.

Update

Here is what I’m doing:

int[] location = {0, 0};
vg1.getLocationOnScreen(location);

newViewWidth = vg1.getRight() - vg1.getLeft();
newViewHeight = vg1.getBottom() - vg1.getTop();

newViewCenterX = newViewWidth/2;
newViewCenterY = newViewHeight/2;

screenWidth = root.getRight() - root.getLeft();
screenHeight = root.getBottom() - root.getTop();

ratioX = (float) screenWidth/newViewWidth;
ratioY = (float) screenHeight/newViewHeight;

rootCenterX = screenWidth/2;
rootCenterY = screenHeight/2;

newView = mInflater.inflate(R.layout.item, null);
LayoutParams lp = new LayoutParams(newViewWidth, newViewHeight);
lp.setMargins(10, 10, 10, 10);
newView.setLayoutParams(lp);

vg1.setVisibility(View.INVISIBLE);

root.addView(newView);

newView.bringToFront();

Log.d(tag, "View vg1 is at " + location[0] + ", " + location[1]);
Log.d(tag, "View vg1 is at top:" + vg1.getTop() + ", left:" + vg1.getLeft() + ", bottom:" + vg1.getBottom() + ", right:" + vg1.getRight());
Log.d(tag, "View vg1 has width " + newViewWidth + " and height " + newViewHeight + " and is centered at X " + newViewWidth/2 + " and Y " + newViewHeight/2);

root.getLocationOnScreen(location);
Log.d(tag, "Root is at " + location[0] + ", " + location[1]);
Log.d(tag, "Root is at top:" + root.getTop() + ", left:" + root.getLeft() + ", bottom:" + root.getBottom() + ", right:" + root.getRight());
Log.d(tag, "Root has width " + screenWidth + " and height " + screenHeight + " and is centered at X " + rootCenterX + " and Y " + rootCenterY);

Log.d(tag, "Root holder center X is at " + (root.getRight() - root.getLeft())/2 + ".");
Log.d(tag, "Root holder center Y is at " + (root.getBottom() - root.getTop())/2 + ".");


Log.d(tag, "RatioX: " + ratioX + ", ratioY: " + ratioY);

ObjectAnimator moveX = ObjectAnimator.ofFloat(newView, "translationX", 0f, rootCenterX - newViewCenterX).setDuration(2000);
ObjectAnimator moveY = ObjectAnimator.ofFloat(newView, "translationY", 0f, rootCenterY - newViewCenterY - 10).setDuration(2000);

ObjectAnimator scaleX = ObjectAnimator.ofFloat(newView, "scaleX", 1f, ratioX).setDuration(2000);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(newView, "scaleY", 1f, ratioY).setDuration(2000);

ObjectAnimator rotateX = ObjectAnimator.ofFloat(newView, "rotationX", 0f, -90f).setDuration(2000);
ObjectAnimator rotateY = ObjectAnimator.ofFloat(newView, "rotationY", 0f, -90f).setDuration(2000);
rotateX.addListener(new AnimatorListener() {
    @Override
    public void onAnimationStart(Animator animation) {}

    @Override
    public void onAnimationRepeat(Animator animation) {}

    @Override
    public void onAnimationEnd(Animator animation) {
        newView.findViewById(R.id.itemImage).setVisibility(View.GONE);
        newView.findViewById(R.id.colorfulBackground).setVisibility(View.VISIBLE);

        ObjectAnimator rotateX = ObjectAnimator.ofFloat(newView, "rotationX", -90f, -180f).setDuration(2000);
        ObjectAnimator rotateY = ObjectAnimator.ofFloat(newView, "rotationY", -90f, -180f).setDuration(2000);

        AnimatorSet animSet = new AnimatorSet();
        animSet.playTogether(rotateX, rotateY);

        animSet.start();
    }

    @Override
    public void onAnimationCancel(Animator animation) {}
});

AnimatorSet animSet = new AnimatorSet();
animSet.playTogether(moveX, moveY, scaleX, scaleY, rotateX, rotateY);

animSet.start();

After aNi’s suggestion, it seems to do the trick.

There is another problem now though. Almost at the middle of the rotation, the view gets clipped for a split second and then comes back to normal.

Do you have any idea what it might be causing it ?
I am thinking that it might be the visible plane of the window or something similar but I don’t know what I should look for. Maybe something with the properties of the parent layout of the animated view ?

  • 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-27T03:08:45+00:00Added an answer on May 27, 2026 at 3:08 am

    Here is an example of flip3d, provides capability of 3D flip- animated swap between two different views – back and front view. http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html

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

Sidebar

Related Questions

I have problem in which I have some rows which I want there to
I have a problem which requires me to parse several log files from a
I have a problem which I think is related to forward declarations, but perhaps
I have a problem which requires a reversable 1:1 mapping of keys to values.
I have a problem which I cant seem to find answer to through searches
I have a problem which I don't know how to fix. It has to
I'm developing an Eclipse plug-in and I have a problem which is reproduced here:
I have a strange problem which I can't fix: A field: private boolean[][][] gaps;
I have a very simple problem which requires a very quick and simple solution
It looks like a problem which could have simple solution, but I haven't found

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.