I've got checkBox in my layout. I add it dynamically in the code. Everything looks ok , but checkbox is not clickable. Here's my xml for checkbox :
<CheckBox xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/pref_calendar_choose_"
style="@style/PreferencesText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00ffffff"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:checked="false"
android:enabled="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:clickable="true"
android:gravity="center_vertical" />
and here's loop where I'm adding checkboxes :
private void refreshView() {
String userEmail = PreferencesManager.User.getEmail();
mCalendarList = CalendarDB.getAll(PreferencesManager.User.getEmail());
mPrefCalendarChoose.removeAllViews();
CheckBox checkBox;
for (int i = 0; i < mCalendarList.size(); i++) {
checkBox = (CheckBox) getLayoutInflater().inflate(R.layout.item_choose_calendar, null);
CalendarDB calendarDB = mCalendarList.get(i);
checkBox.setText(calendarDB.summary);
checkBox.setId(i);
checkBox.setOnClickListener(listener);
if(calendarDB.summary.contains(userEmail)) {
calendarDB.selected = true;
}
else {
calendarDB.selected = false;
}
checkBox.setChecked(calendarDB.selected);
Log.e(TAG, "refreshView: " + calendarDB.selected );
if (checkBox.getText() != "") ;
mPrefCalendarChoose.addView(checkBox);
}
}
Everything is set up well but checkbox doesn't react for clicking
Aucun commentaire:
Enregistrer un commentaire