2012-08-23 101 views

回答

1

你可以在一個線性佈局的高度提出的形象圖動畫是包裹內容和寬度是填補父

代碼爲動畫

public static Animation inFromLeftAnimation() { 
Animation inFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, 
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f 
); 
inFromLeft.setDuration(350); 
inFromLeft.setInterpolator(new AccelerateInterpolator()); 
return inFromLeft; 
} 
public static Animation outToLeftAnimation() { 
Animation outtoLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, 
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f 
); 
outtoLeft.setDuration(350); 
outtoLeft.setInterpolator(new AccelerateInterpolator()); 
return outtoLeft; 
} 
+0

謝謝,但我想移動與手指速度滑塊。在這段代碼中速度是固定的。 – CoolDeep

+0

根據您的願望 –

+0

相應更改動畫或只是自定義滑動抽屜(將抽屜調用者設置爲隱形 –