lopez.mikhael
lopez.mikhael

Reputation: 10061

How to create a right/left Background animation?

I try to develop an application with a left/right animation on the background on the first screen.

For example, this application have an image in background and this image move from left to right. It's exactly what I want to do.

enter image description here

I try with this code :

ImageView imageViewBackground = (ImageView)findViewById(R.id.imageViewBackground);

Animation animation = new TranslateAnimation(0.0f, 200.0f, 0.0f, 0.0f);
animation.setDuration(5000);
imageViewBackground.startAnimation(animation);

and

<ImageView android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/imageViewBackground"
    android:src="@drawable/background"
    android:scaleType="centerCrop" />

But the imageView with this scaleType are cropped and we can't see the content of the imageView entirely current the animation.

Upvotes: 0

Views: 558

Answers (1)

GIGAMOLE
GIGAMOLE

Reputation: 1266

You can use my SlideImageView library from the GitHub. It gives you what you want.

Upvotes: 1

Related Questions