Material Design Components?
bartekpacia opened this issue · comments
Bartek Pacia commented
Are there plans to add these to Anko? It isn't possible insets on Buttons, strokeColor on CardView etc.
Ageev Valentin commented
I added example to wiki (https://github.com/Kotlin/anko/wiki/Anko-Layouts-Examples#styles). Try
<style name="App.ThemeOverlay.MaterialComponents.Button.Custom"
parent="ThemeOverlay.MaterialComponents">
<item name="materialButtonStyle">
@style/Widget.MaterialComponents.Button.TextButton.Custom
</item>
</style>
<style name="App.MaterialComponents.TextButton.Custom"
parent="Widget.MaterialComponents.Button.TextButton">
<item name="android:insetTop">8dp</item>
</style>
inline fun ViewManager.materialButton(@StyleRes theme: Int, init: MaterialButton.() -> Unit = {}): MaterialButton {
return ankoView({ MaterialButton(it) }, theme, init = init)
}
Using:
materialButton(R.style.App_ThemeOverlay_MaterialComponents_Button_Custom)