I'd like to create a MaterialButton programmatically and use the TextButton style on it.
I tried the following but the resulting button has a background color and is not a TextButton.
val newContext = ContextThemeWrapper(this, R.style.Widget_MaterialComponents_Button_TextButton)
val errorBtn = MaterialButton(newContext, null, R.style.Widget_MaterialComponents_Button_TextButton)
I tried many variants, (without using the 3 parameters constructor or without context wrapper).
I found this question: Apply Style to MaterialButton programmatically
But the answer is not satisfying as the setting background tint do not produce good results (there is a shadow being the button).