目前我使用設置機器人動畫的setBackground
BitmapDrawable bd = new BitmapDrawable(getResources(), mBlurredMap);
mLytProfileCover.setBackground(bd);
我怎麼能演示這一個的LinearLayout的背景嗎?例如,背景的alpha在500ms內從0變爲1的淡入動畫。
感謝。
目前我使用設置機器人動畫的setBackground
BitmapDrawable bd = new BitmapDrawable(getResources(), mBlurredMap);
mLytProfileCover.setBackground(bd);
我怎麼能演示這一個的LinearLayout的背景嗎?例如,背景的alpha在500ms內從0變爲1的淡入動畫。
感謝。
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mLytProfileCover, View.ALPHA, 0.0f, 1.0f);
alphaAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(final Animator animation) {
mLytProfileCover.setBackground(bd);
}
});
alphaAnimator.setDuration(500);
alphaAnimator.start();
這會將整個LinearLayout可見性從0更改爲1.我正在尋找只改變其背景的方式,而不是線性佈局內的內容。 – windchime
@windchimez有一個'View'作爲你佈局的第一個孩子。將背景設置爲該「視圖」,並對其進行動畫處理,而不是佈局。 – azizbekian
不錯的問題,因爲在Android中的一切似乎對我來說太靜態了。如果您使用CustomViews,則會出現很多... – statosdotcom