I am programmatically creating a LinearLayout for an AlertDialog with some buttons.
I WANT to do this:
         
In my case style was not loaded at all when I pass them into Button constructor.
It seems that was because I was using the material design view. Here what solved my case:
val themeWrapper = ContextThemeWrapper(
      context,
      R.style.AppTheme_ButtonPrimary // my button style
)
val button = MaterialButton(themeWrapper)
Please note that MaterialButton was created instead of Button.
I found this solution at: How to specify a style for a view programmatically in Android.