0
如何在列表視圖中顯示具有淡入淡出效果的圖像(我不知道確切的名稱),就像應用程序在做的那樣。 https://play.google.com/store/apps/details?id=com.yummly.android 對此類庫或有用資源的任何引用?如何在列表視圖中顯示淡入淡出效果的圖像?
如何在列表視圖中顯示具有淡入淡出效果的圖像(我不知道確切的名稱),就像應用程序在做的那樣。 https://play.google.com/store/apps/details?id=com.yummly.android 對此類庫或有用資源的任何引用?如何在列表視圖中顯示淡入淡出效果的圖像?
你可以用這個例子
在適配器(擴大BaseAdapter或ArrayAdapter):
private int lastPosition = -1;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//.....inflating and bind view
setAnimation(convertView, position);
return convertView;
}
/**
* Here is the key method to apply the animation
*/
private void setAnimation(View viewToAnimate, int position) {
// If the bound view wasn't previously displayed on screen, it's animated
if (position > lastPosition) {
Animation animation = AnimationUtils.loadAnimation(mContext, android.R.anim.fade_in);
viewToAnimate.startAnimation(animation);
lastPosition = position;
}
}
或爲RecyclerView.Adapter:
@Override
public void onBindViewHolder(final HistoryHolder holder, final int position) {
....
setAnimation(holder.animatedView, position);
}
你的意思動畫效果嗎? –
是動畫。 –