https://kotlinlang.org logo
#anko
Title
j

jovmit

01/26/2017, 8:01 AM
@tania did you find a solution? passing the style in the constructor should do it, something like:
Copy code
button(R.style.BlueButtonStyle) {
    textSize = sp(14)
    textResource = R.string.save_search
}
additionally, you can take advantage of using
applyRecursively{}
to apply styles, because officially the function
style()
is deprecated, and internally it also uses
applyRecursively
Copy code
@Deprecated("Use applyRecursively(block) instead.", ReplaceWith("applyRecursively(style)"))
fun <T : View> T.style(style: (View) -> Unit): T = applyRecursively(style)