按钮单击时摇动gridView的每个视图

时间:2013-10-20 08:05:11

标签: android gridview

我有一个动态网格视图,可以按预期显示视图。但现在我想在按钮点击时为每个视图设置摇动动画 例如,当我单击编辑按钮时,每个视图都会抖动,然后我可以从网格中删除该视图 这是我的适配器:

public class ImageAdapter extends BaseAdapter
{
private Context mContext;
private final List<Struct_Wallet_Name> wallets;

public ImageAdapter(Context c, List<Struct_Wallet_Name> wallets)
{
    this.mContext = c;
    this.wallets = wallets;

}

public int getCount()
{
    return wallets.size();
}

public Object getItem(int position)
{
    return null;
}

public long getItemId(int position)
{
    return 0;
}

// create a new ImageView for each item referenced by the Adapter
public View getView(final int position, View convertView, ViewGroup parent)
{
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View gridView;

    if(convertView == null)
    {
        gridView = new View(mContext);
        gridView = inflater.inflate(R.layout.wallet_icons, null);
        gridView.setPadding(8, 8, 8, 8);

        final Animation animBounce = AnimationUtils.loadAnimation(mContext, R.anim.bounce);
        gridView.startAnimation(animBounce);

        TextView textView = (TextView) gridView.findViewById(R.id.id_tv_wallet);
        textView.setText(String.valueOf(wallets.get(position).str_WalletName));

    }
    else
    {
        gridView = (View) convertView;
    }

    return gridView;

} 
}  

知道怎么做吗?

0 个答案:

没有答案