1
我在查找解决方案时发现问题,该解决方案从RelativeLayout的中心转换ImageView,方式为该ImageView的左上角保留在布局的左上角。大多数选项都会将ImageView的中心作为参考,并且/或在所有屏幕尺寸上都不能很好地工作。将ImageView翻译为左上角
这里是最好的选择,到目前为止,除了事实的ImageView的中心停留在布局的左上角(0,0):
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);