我有一个现有用户的 ListviewEditText
和 TextViews。我正在使用 EditText 添加新用户。输入名称后如何通过 EditText 添加新用户?结果应该出现在 ListView 中,如下所示![在此处输入图像描述][1]。
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder;
if(convertView==null)
{
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.savelistviewadapter, null);
holder.username = (TextView)convertView.findViewById(R.id.username);
holder.newuser = (EditText) convertView.findViewById(R.id.newuser);
holder.radiosave = (RadioButton) convertView.findViewById(R.id.radiosaveuser);
// holder.img = (ImageView) convertView.findViewById(R.id.temperrr);
convertView.setTag(holder);
}
else
holder=(ViewHolder)convertView.getTag();
ItemBean bean = (ItemBean) itemList.get(position);
// holder.imgViewLogo.setBackgroundResource(bean.getImage());
holder.username.setText(bean.getTitle());
if(holder.newuser.getText().toString().length()>0)
{
holder.username.setText(holder.newuser.getText().toString());
}
// holder.txtViewDescription.setText(bean.getDescription());
// holder.img.setImageResource(R.drawable.ic_download);
if(position==getCount()-1)
{
holder.newuser.setVisibility(View.VISIBLE);
}
else
{
holder.newuser.setVisibility(View.GONE);
}
return convertView;
}
}