我想實現一張紙上出現的項目列表的一張紙的效果。我提出了一種方法,但是當我正在研究它時,我不能一直認爲必須有更好的方法。動畫ListView到視圖
我的方法:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/orderDetailListView">
</ListView>
</LinearLayout>
動畫代碼:
final int newMargin = <some value>;
Animation a = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
LayoutParams params = listView.getLayoutParams();
params.leftMargin = (int)(newMargin * interpolatedTime);
yourView.setLayoutParams(params);
}
};
listView.startAnimation(a)的
我的問題:
有沒有更好的方法?我不是在問一個暗示性的問題,我只是想知道是否有某種內置函數可以使觀點從一個設定點逐漸出現。
我不完全確定你想要動畫看起來像什麼,它聽起來像一個簡單的翻譯動畫? – rperryng
看看這個庫:https://github.com/nhaarman/ListViewAnimations。希望它可以幫助。 –
我從yplan應用程序添加圖片是一樣的想法。我沒有試圖移動它,因爲它顯示它緩慢出現 – Mika