Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!

Paul Hinrichsen

+ Follow
since May 15, 2020
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Hinrichsen

Good day All

I am using Android Studio 3.6.3

The scenario I need to set up is as follows;

I need a picture inside an ImageView (or something similar). The picture starts in the centre of the ImageView. I need one button which will rotate the ImageView (and thus also rotate the picture inside the ImageView).
A second button which will move the picture inside the ImageView (but NOT the ImageView) along the X line.

The code for the ImageView is


The picture is the item @drawable/mapsmall

I define the ImageView in Java as

imageView = (ImageView) findViewById(;

The code for the rotate animation is

ObjectAnimator rotateMap = ObjectAnimator.ofFloat(imageView,
               "rotation", 0f, 180f)

The code for the moveX is

ObjectAnimator moveX = ObjectAnimator.ofFloat(imageView,
               "translationX", 200f, 500f)

Now the rotation works fine and rotates the ImageView.
The MoveX works well and moves the ImageView.

Since both animations target

imageView = (ImageView) findViewById(;

This may be no surprise.

In the MoveX animation how do I TARGET ONLY the picture which is inside the ImageView and not the whole ImageView? My Animation requires me to move the image inside the imageView (if this is possible)

I am new to AS (that may be obvious from my code).

I have previously coded this animation successfully in both ActionScript3 as wel as in Javascript. I know that Java is a much more powerful code than either. it MUST be possible to do this ?

Any help will be greatly appreciated.


1 week ago