listview - ListAdapter值不显示

  显示原文与译文双语对照的内容
0 0

在列表视图中需要dispaly值,并且需要在列表视图中单独对特定textview执行单击

我尝试过这样


ListAdapter adapter = new SimpleAdapter(
 ViewAppoinmentScreen.this, medicationlist,
 R.layout.appoinmentlist, new String[] {
"clinic_name","id","app_type",
"app_date","app_time","app_desc" },
 new int[] { R.id.name, R.id.app_id,
 R.id.app_type, R.id.date, R.id.time,
 R.id.comments }){

 @Override
 public View getView (int position, View convertView, ViewGroup parent) {
 LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 View rowView = mInflater.inflate(
 R.layout.appoinmentlist, parent, false);
 ImageView del = (ImageView) rowView
. findViewById(R.id.imageView3);
 del.setOnClickListener(new View.OnClickListener() {

 @Override
 public void onClick(View v) {
 String id = ((TextView) findViewById(R.id.app_id))
. getText().toString();
 Toast.makeText(ViewAppoinmentScreen.this," Clicked Successfully", Toast.LENGTH_LONG).show();
 System.out.println("deleted action"+id);


 }
 });

 return rowView;
 }

 };

 med_list.setAdapter(adapter);

Getview方法是工作的,我可以看到in消息,但我无法看到我的listview中的值。 值未设置为适配器。 我所做的错误是什么请帮助我。

先谢谢了。

时间: 原作者:

0 0

我通过像这样替换 getView 来解决我的issuse


@Override
 public View getView (int position, View convertView, ViewGroup parent)
 {
 View v = super.getView(position, convertView, parent);

 ImageView del = (ImageView) v
. findViewById(R.id.imageView3);
 del.setOnClickListener(new OnClickListener() {

 @Override
 public void onClick(View arg0) {
//TODO Auto-generated method stub
 Toast.makeText(ViewAppoinmentScreen.this,"Deleted",Toast.LENGTH_SHORT).show();
 }
 });
 return v;
 }

现在它的精细。

原作者:
...