I ran into the same problem and now I have a material_factory_ * xml file for each of my dynamically created views. It annoys him a bit, but it works:
// checkbox = new CeckBox(context); checkbox = (CheckBox) View.inflate(context, R.layout.material_factory_checkbox, null);
And the file material_factory_checkbox.xml:
<?xml version="1.0" encoding="utf-8"?> <CheckBox xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" />
source share