PracticeGridAdapter.java 966 字节
package com.hh.xuetubao.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.hh.xuetubao.R;

import java.util.List;

public class PracticeGridAdapter extends BaseAdapter {
    private List<String> list;
    private Context context;

    public PracticeGridAdapter(List<String> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.practice_grid, null);
        return view;
    }
}