Vote count:
0
I'm having problems finding a solution that translates an ImageView from the center of a RelativeLayout, in a way that the top left corner of that ImageView stays in the top left corner of the layout. Most options translate having the center of the ImageView as a reference and/or doesn't work well on all screen sizes.
Here is the best option so far, except the fact that the center of the ImageView stays at the top left corner (0,0) of the layout:
TranslateAnimation anim = new TranslateAnimation(
TranslateAnimation.RELATIVE_TO_PARENT,0.0f,
TranslateAnimation.RELATIVE_TO_PARENT,-0.5f,
TranslateAnimation.RELATIVE_TO_PARENT,0.0f,
TranslateAnimation.RELATIVE_TO_PARENT,-0.5f
);
anim.setFillAfter(true);
anim.setDuration(1000);
image.startAnimation(anim);
asked 1 min ago
Translating an ImageView to the top left corner
Aucun commentaire:
Enregistrer un commentaire