0
這裏是我的Android應用程序在Android Studio代碼:我想用動畫更改邊距以在我的Android應用中移動此邊距。怎麼做?
FrameLayout root = (FrameLayout) findViewById(R.id.root);
ImageView img = new ImageView(this);
img.setBackgroundColor(Color.RED);
//..load something inside the ImageView, we just set the background color
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(20, 20);
params.leftMargin=Math.round(deltaX);
params.topMargin=Math.round(deltaY);
root.addView(img,params);
//...
我想與動畫中移動這個時候TOPMARGIN和LEFTMARGIN變化值。
謝謝你..你的回答對我很有幫助。你能告訴我如何讓動畫流暢嗎?我認爲可以使用爲動畫製作的那些類來完成。 –
@FaruqueAhamedMollick更新。 – Yat3s