簡體   English   中英

在Android中從頂部到底部移動imageview

[英]Moving imageview from top to bottom in android

我在屏幕中央有一個ImageView,我想向上移動它。 它保持在頂部。 我看到了Tween動畫文檔,並對其進行了嘗試,但無法正常工作。 請問誰能幫助我解決這個問題。

您是否嘗試查看動畫?

Animation an = new TranslateAnimation(fromX,fromY,toX,toY);//0,0 is the current       coordinates
an.setFillAfter(true);// to keep the state after animation is finished
yourView.startAnimation(an);// to start animation obviously

要使其從底部移動到頂部,請獲取屏幕高度並使用它來設置“ toY”參數。

經過幾次嘗試,您一定會做得到。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM