I have a problem with androidx.appcompat:appcompat:1.1.0. It\'s a new problem because on androidx.appcompat:appcompat:1.0.2 it does not exist.
I have a code that uses re
Everybody.
I was able to do it.
First, i put the spinner on the activity with java code. "programatically".
public void initTest(){
spinner2 = new Spinner(this, Spinner.MODE_DROPDOWN);
spinner2.setAdapter(new ArrayAdapter(this, R.layout.spinner_item, datos));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
spinner2.setId(spinner2.generateViewId());
}
ConstraintLayout parentLayout = (ConstraintLayout)findViewById(R.id.main_activity);
parentLayout.addView(spinner2, 0);
ConstraintSet cs = new ConstraintSet();
cs.clone(parentLayout);
cs.setHorizontalBias(spinner2.getId(), 0.473F);
cs.setVerticalBias(spinner2.getId(), 0.484F);
cs.connect(spinner2.getId(), ConstraintSet.BOTTOM, parentLayout.getId(),ConstraintSet.BOTTOM);
cs.connect(spinner2.getId(), ConstraintSet.START, parentLayout.getId(),ConstraintSet.START);
cs.connect(spinner2.getId(), ConstraintSet.TOP, parentLayout.getId(),ConstraintSet.TOP);
cs.connect(spinner2.getId(), ConstraintSet.END, parentLayout.getId(),ConstraintSet.END);
// cs view id, else getId() returns -1
// connect start and end point of views, in this case top of child to top of parent.
// ... similarly add other constraints
cs.applyTo(parentLayout);
}
Then i call the code put at the beginning in my question.
I hope it works for many people, and to skip this error of the new version.
Regards.