基本的に、最初のアイテムのチェックボックスをオフにすると、2番目のアイテムは「グレー表示」され、クリックできないか、無効になります。
@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()
。それは正しい方法ですか?もしそうなら、アイテムをターゲットにする方法がわかりません。もし今、最善の方法は何ですか?