Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Material Design Components? #724

Open
bartekpacia opened this issue Jan 31, 2019 · 1 comment
Open

Material Design Components? #724

bartekpacia opened this issue Jan 31, 2019 · 1 comment

Comments

@bartekpacia
Copy link

Are there plans to add these to Anko? It isn't possible insets on Buttons, strokeColor on CardView etc.

@ageevvalentin
Copy link

ageevvalentin commented Apr 12, 2019

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants