'Swipe MultiChoice items GridView Android
I have code multichoice items gridview in android when swipe, but when I swipe diagonal line it usurpation other item. I want check when I swipe to center cell. but I can't. please help me. 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) {
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
