Android 当我在列表视图中向下滚动时,列表不可单击
我在列表视图中显示项目,当我单击列表时导航到下一个活动,但当我在列表视图中向下滚动,然后单击列表时,它不工作意味着列表没有单击,我很想知道为什么会发生这种情况。请帮我一些忙 谢谢 在列表视图中显示的我的代码..是Android 当我在列表视图中向下滚动时,列表不可单击,android,Android,我在列表视图中显示项目,当我单击列表时导航到下一个活动,但当我在列表视图中向下滚动,然后单击列表时,它不工作意味着列表没有单击,我很想知道为什么会发生这种情况。请帮我一些忙 谢谢 在列表视图中显示的我的代码..是 class MyAdapter extends BaseAdapter implements OnClickListener { private LayoutInflater inflater; public MyAdapter(Context ctx) { s
class MyAdapter extends BaseAdapter implements OnClickListener
{
private LayoutInflater inflater;
public MyAdapter(Context ctx) {
super();
this.inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return totalartist;
}
/* Not implemented but not really needed */
@Override
public Object getItem(int position) {
return null;
}
/* Not implemented but not really needed */
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View ConvertView, ViewGroup parent)
{
View v = inflater.inflate(R.layout.listitem_layout, parent, false);
// Log.i("array galoijewdh..",keywordresulttab.array_galleryname[position]);
// Variables.a=3;
try{
String gallerynames = keywordsearch.array_galleryname[position];
String addresses = keywordsearch.array_address[position];
TextView tv = (TextView) v.findViewById(R.id.barrio);
tv.setText(gallerynames);
tv = (TextView) v.findViewById(R.id.ciudad);
tv.setText(addresses);
((BaseAdapter)(getListAdapter())).notifyDataSetChanged();
// return v;
}catch(NullPointerException e){}
return v;
}
@Override
public void onClick(DialogInterface dialog, int which)
{
}
}
}
参考此
问题似乎出现在您的使用方式中。请参阅此
当我删除((BaseAdapter)(getListAdapter())。notifyDataSetChanged()时,问题似乎出现在您的视图中;然后,当我删除((BaseAdapter)(getListAdapter())时,它工作正常;那就行了