我有代码mutil选择项目gridview在android中滑动时,但是当我滑动对角线时它篡改其他项目。当我向中心单元格滑动时,我想要检查。但我不能。请帮我。 screen here
gridWordTable.setAdapter(adapter);
gridWordTable.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
gridWordTable.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
int i = gridWordTable.pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
if (i >= 0 && i < listCharater.length * listCharater.length) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
adapter.notifyDataSetChanged();
}
if (motionEvent.getAction() == MotionEvent.ACTION_MOVE) {
gridWordTable.getChildAt(i).setBackground(getResources().getDrawable(R.drawable.border_selected));
}
}
return true;
}
});
gridWordTable.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
view.setSelected(true);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});