我有一个带有 textview 和 edittext 的自定义列表视图。当列表视图有 6 个或更少但超过 6 个项目的列表视图时没有问题,就像这个视频一样。我该如何解决这个问题?
public class Form2 extends ListActivity {
CustomListAdapter cla;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_form2);
cla = new CustomListAdapter(this);
setListAdapter(cla);
}
我的自定义适配器是
public class CustomListAdapter extends BaseAdapter{
private LayoutInflater mInflater;
private ArrayList<Siparis> notlar;
public CustomListAdapter(Context context) {
mInflater = LayoutInflater.from(context);
notlar = new ArrayList<Siparis>();
DBHandler db = new DBHandler(context);
db.getWritableDatabase();
notlar=db.getSiparis();
db.close();
}
@Override
public int getCount() {
return notlar.size();
}
@Override
public Siparis getItem(int position) {
return notlar.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.activity_kap, null);
holder = new ViewHolder();
holder.mKonu = (TextView) convertView.findViewById(R.id.malzeme);
holder.mTarih2 = (EditText) convertView.findViewById(R.id.miktar);
}
else {
holder = (ViewHolder) convertView.getTag();
}
//holder.mTarih2.setText(String.valueOf(notlar.get(position).miktar));
holder.mKonu.setText(notlar.get(position).malzeme_adi);
convertView.setTag(holder);
return convertView;
}
public class ViewHolder {
TextView mKonu;
EditText mTarih2;
}
}