I am working on app. in which login screen have a bcakground image. I want to move left to right this background image.how can i do this.?
A sample code i have using but this will move the image and left the layout balnk. i dont want it.
ImageView img_animation = (ImageView) findViewById(R.id.img_animation);
TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f,
0.0f, 0.0f);
animation.setDuration(5000);
animation.setRepeatCount(5);
animation.setRepeatMode(2);
animation.setFillAfter(true);
img_animation.startAnimation(animation);
I just want to implement as like this application screen :
check this application login screen in device. login screen have an image in background. and this image move from left to right. How can i achieve this process.please assist me.
You can try to use matrix.
set the scaleType of the ImageView to matrix.
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix" />
then translate the matrix used by the ImageView a little bit to the right every milliseconds.
Matrix matrix = new Matrix();
matrix.postTranslate(x, y);
img_animation.setImageMatrix(matrix);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With