基本上我想要当我取消选中第一项上的框时,第二项是“灰色的”并且不可点击或禁用。
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(position == 0) {
//disable.enable push
CheckBox checkBox = (CheckBox) mRoot.findViewById(R.id.cbRowCheckBox);
checkBox.setChecked(!checkBox.isChecked());
mPushEnabled = checkBox.isChecked();
if (mPushEnabled) {
//code for push enabled
//code to let position 1 enabled, i was thinking something along th e lines,
adapter.getposition(1).setEnabled(true);
} else {
//code for push disabled
adapter.getposition(1).setEnabled(false);
}
} else if(position == 1) {
//push notification settings
//open intent
}
}
我在想我可以得到项目所在的位置,然后将其设置为 false setEnabled()
。那是正确的方法吗?如果是这样,我不知道如何定位该项目。如果现在,最好的方法是什么?