0

我有一个 BaseAdapter 和自定义行我有几个项目,如 TextView、ImageView 和 Snipper。

现在,当这个人滚动该 ListView 时。Snipper 包含类似 {1 --> 10}。将 FirstRow 上的选择从 1-->3 更改后

然后向下滚动。在那之后,Row 消失了。返回值是回到 1 而不是 3。

我确实注意到的是,它一次又一次地绑定,而不是上下波动。

那么有什么解决方案吗?这是我的 BaseAdapter。

public class VDC_QN_Adapter extends BaseAdapter {

private Activity activity;
private ArrayList<HashMap<String, String>> data;
private static LayoutInflater inflater = null;
public ImageLoader imageLoader;

public  VDC_QN_Adapter(Activity a,
        ArrayList<HashMap<String, String>> d) {
    activity = a;
    data = d;
    inflater = (LayoutInflater) activity
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    imageLoader = new ImageLoader(activity.getApplicationContext());
}

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

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

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

public View getView(int position, View convertView, ViewGroup parent) {

    View vi = inflater
            .inflate(R.layout.row,
                    parent, false);

    TextView title = (TextView) vi
            .findViewById(R.id.row_ItemName); // title


    HashMap<String, String> song = new HashMap<String, String>();
    song = data.get(position);

    // Setting all values in listview
    title.setText(song.get(VDC_QN.ItemName));

    try {
        Spinner spinner2 = (Spinner) vi
                .findViewById(R.id.spinner1);
        List<String> list1 = new ArrayList<String>();
        for (int row = 0; row <= 10; row++) {
            list1.add(Integer.toString(row));
        }

        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(
                vi.getContext(), android.R.layout.simple_spinner_item,
                list1);
        dataAdapter
                .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner2.setAdapter(dataAdapter);

    } catch (Exception ex) {
        Log.i("infor", "adfasdfs");
    }

    return vi;
}
}
4

0 回答 0