-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkboxes are purple #5
Comments
Is the screenshot from the app or from the layout editor? Please, post some source code and xmls. |
The screenshot is from the app itself, here is the source code that generates the checkboxes: for(int i = 0; i <= 11; i++) { // loop as many times as needed for parent; i<=category.length
dynamicParentCheckBox = new IndeterminateCheckBox(mActivity.getApplicationContext());
// if has child, create dynamicChildCheckbox
dynamicParentCheckBox.setTextColor(mActivity.getResources().getColor(R.color.white));
dynamicParentCheckBox.setText("Parent Category " + i ); // TODO: switch to getCategoryName
dynamicParentCheckBox.setOnStateChangedListener(new IndeterminateCheckBox.OnStateChangedListener() {
@Override
public void onStateChanged(IndeterminateCheckBox indeterminateCheckBox, @Nullable Boolean state) {
if(state = null) {
//indeterminate
} else if(state) {
//checked
} else {
//unchecked
}
}
});
mDialogContainer.addView(dynamicParentCheckBox);
if(hasChild) {
for(int j = 0; j <= 3; j++) { //loop as many times as needed for children; i <= subcategory.length
dynamicChildCheckBox = new IndeterminateCheckBox(mActivity.getApplicationContext());
dynamicChildCheckBox.setTextColor(mActivity.getResources().getColor(R.color.white));
dynamicChildCheckBox.setText("Child Category " + j); // TODO: switch to getSubcategoryName
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(60, 0, 0, 0);
dynamicChildCheckBox.setLayoutParams(params);
dynamicChildCheckBox.setOnStateChangedListener(new IndeterminateCheckBox.OnStateChangedListener() {
@Override
public void onStateChanged(IndeterminateCheckBox indeterminateCheckBox, @Nullable Boolean state) {
if(state = null) {
//indeterminate
// this wont happen since subcategories have no children
}
else if(state) {
//checked
}
else {
//unchecked
}
}
});
mDialogContainer.addView(dynamicChildCheckBox);
}
}
} The only XML is a |
Please try which API levels fail exactly.
…On Mon, 2 Oct 2017 at 18:09 Tim ***@***.***> wrote:
The screenshot is from the app itself, here is the source code that
generates the checkboxes:
for(int i = 0; i <= 11; i++) { // loop as many times as needed for parent; i<=category.length
dynamicParentCheckBox = new IndeterminateCheckBox(mActivity.getApplicationContext());
// if has child, create dynamicChildCheckbox
dynamicParentCheckBox.setTextColor(mActivity.getResources().getColor(R.color.white));
dynamicParentCheckBox.setText("Parent Category " + i ); // TODO: switch to getCategoryName
dynamicParentCheckBox.setOnStateChangedListener(new IndeterminateCheckBox.OnStateChangedListener() {
@OverRide
public void onStateChanged(IndeterminateCheckBox indeterminateCheckBox, @nullable Boolean state) {
if(state = null) {
//indeterminate
} else if(state) {
//checked
} else {
//unchecked
}
}
});
mDialogContainer.addView(dynamicParentCheckBox);
if(hasChild) {
for(int j = 0; j <= 3; j++) { //loop as many times as needed for children; i <= subcategory.length
dynamicChildCheckBox = new IndeterminateCheckBox(mActivity.getApplicationContext());
dynamicChildCheckBox.setTextColor(mActivity.getResources().getColor(R.color.white));
dynamicChildCheckBox.setText("Child Category " + j); // TODO: switch to getSubcategoryName
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(60, 0, 0, 0);
dynamicChildCheckBox.setLayoutParams(params);
dynamicChildCheckBox.setOnStateChangedListener(new IndeterminateCheckBox.OnStateChangedListener() {
@OverRide
public void onStateChanged(IndeterminateCheckBox indeterminateCheckBox, @nullable Boolean state) {
if(state = null) {
//indeterminate
// this wont happen since categories have no children
}
else if(state) {
//checked
}
else {
//unchecked
}
}
});
mDialogContainer.addView(dynamicChildCheckBox);
}
}
}
The only XML is a LinearLayout inside of a ScrollView that the elements
are added to (mDialogContainer)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHS1Yet2ZmMQX8vvmZmlbV7EjNrZIDaks5soPyxgaJpZM4PqsTr>
.
|
I currently only use API 25+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
For some reason when attempting to dynamically generate these, the checkbox appears on the UI as a purple colour that does not exist in my styles nor colour file. Any idea what's going on?
Thanks!
The text was updated successfully, but these errors were encountered: