尝试制作排序列表视图,当特定项目位于其排序位置时我想要修复它,即我想要禁用该特定项目 我尝试的是Draggable Listview item on click disable我也试过[在这里输入链接描述] [1]任何人都可以解释我错在哪里
[1]:How to get clicked item position from Custom ListView in android?,我的getview和myonitemclicklistener是
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
boolean isConverted = true;
if (view == null) {
Log.v("talkinginterval", "create view " + position);
view = mInflater.inflate(mViewResourceId, parent, false);
isConverted = false;
}
modifyView(position, view, isConverted);
for (int i = 0; i < mTo.length; i++) {
View v = view.findViewById(mTo[i]);
String from = mFrom[i];
String data = mDataProvider.getItem(position);
Long strId =mDataProvider.getItemId(position);
Log.d("AstrId", "strId="+strId);
Log.d("A", "mDataProvider.getItem(position)="+mDataProvider.getItem(position));
String d = data.toString();
myList.put(position, strId);
boolean bound = false;
if (mViewBinder != null) {
bound = mViewBinder.setViewValue(view, v, d, from);
}
if (!bound) {
if (v instanceof TextView) {
((TextView) v).setText(d);
} else {
throw new IllegalStateException(v.getClass().getName() + " is not a "
+ " view that can be bounds by this Adapter");
}
}
and
mylist.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int pos,
long id) {
// TODO Auto-generated method stub
TextView c = (TextView) view.findViewById(R.id.textView1);
String playerChanged = c.getText().toString();
Log.d("A", "" + "Item clicklistener" + pos);
mDraggableListView.setDragStatus(true);
if (pos == 0) {
Log.d("A0", "" + "Item clicklistener" + pos);
// mDraggableListView.setDragStatus(false);
}/*
* else{ mDraggableListView.setDragStatus(true); }
*/
Long myid = GenericAdapter.myList.get(pos);
Log.d("Afinal", "myid"+myid);
}
});