在我的gridview中有imageview.I想要禁用當前項目/圖像在android.config中的gridview中點擊我不能做到這一點。 這裏是一個代碼 -如何在gridview中禁用項目android
@Override
public void onItemClick(AdapterView<?> arg0, View v, int no,long lg) {
// TODO Auto-generated method stub
final AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
id=no;
final EditText input = new EditText(MainActivity.this);
alert.setView(input);
alert.setPositiveButton("Check", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString();
AlertDialog.Builder alert1 = new AlertDialog.Builder(MainActivity.this);
if(value.equalsIgnoreCase(country[id])){
// here i want to disable item
alert1.setPositiveButton("Correct", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
}
else
{
}
}
});
alert.show();
}
});
你做了什麼來禁用一個項目? – mango
以及「禁用項目」是什麼意思? –
第一次當我點擊任何item.then執行操作後,下一次該項目不應該被點擊/選擇 –