Android 如何设置简单视图的动画以从下向上移动?
我需要实现某种类型的进度条。它应该是简单的视图,从上到下无限移动。我的概念艺术具有以下特点: 黄色区域应该从底部移动。如何设置动画?使用此方法:Android 如何设置简单视图的动画以从下向上移动?,android,android-animation,Android,Android Animation,我需要实现某种类型的进度条。它应该是简单的视图,从上到下无限移动。我的概念艺术具有以下特点: 黄色区域应该从底部移动。如何设置动画?使用此方法: private void moveViewToScreenCenter( View view ) { RelativeLayout root = (RelativeLayout) findViewById( R.id.rootLayout ); DisplayMetrics dm = new DisplayMetrics();
private void moveViewToScreenCenter( View view )
{
RelativeLayout root = (RelativeLayout) findViewById( R.id.rootLayout );
DisplayMetrics dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics( dm );
int statusBarOffset = dm.heightPixels - root.getMeasuredHeight();
int originalPos[] = new int[2];
view.getLocationOnScreen( originalPos );
int xDest = dm.widthPixels/2;
xDest -= (view.getMeasuredWidth()/2);
int yDest = dm.heightPixels - (view.getMeasuredHeight()/2) - statusBarOffset;
TranslateAnimation anim = new TranslateAnimation( 0, xDest - originalPos[0] , 0, yDest - originalPos[1] );
anim.setDuration(1000);
anim.setFillAfter( true );
view.startAnimation(anim);
}
这个方法将视图移到中心,我需要另一个效果。我已经用gif动画更新了我的问题。显示一些代码,到目前为止您尝试了什么。