Android 中的 TranslateAnimation 和相邻视图
TranslateAnimation in Android with adjacent view
我有一个 TransaleAnimation 视图,效果很好。问题是视图有一个 android:layout_toRightOf="@id/iv_hook" 到不随视图动画的 ImageView。有什么办法可以实现吗?
The ImageView is for show/hide. when the view slides out i want 'Show' image to display.
尝试这样的事情:
// yourImageView is hidden => its visibility is View.GONE
// animate your view with translation => slide out effect
viewToAnimate.animate().translationX(newTranslationX).setDuration(duration).withEndAction(new Runnable() {
@Override
public void run() {
// now, as the animation has just finished, we want to show the image
yourImageView.setVisibility(View.VISIBLE);
}
}).start();
我有一个 TransaleAnimation 视图,效果很好。问题是视图有一个 android:layout_toRightOf="@id/iv_hook" 到不随视图动画的 ImageView。有什么办法可以实现吗?
The ImageView is for show/hide. when the view slides out i want 'Show' image to display.
尝试这样的事情:
// yourImageView is hidden => its visibility is View.GONE
// animate your view with translation => slide out effect
viewToAnimate.animate().translationX(newTranslationX).setDuration(duration).withEndAction(new Runnable() {
@Override
public void run() {
// now, as the animation has just finished, we want to show the image
yourImageView.setVisibility(View.VISIBLE);
}
}).start();