Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style set to MaterialButton has no effect #195

Open
milken opened this issue May 13, 2019 · 1 comment
Open

Style set to MaterialButton has no effect #195

milken opened this issue May 13, 2019 · 1 comment

Comments

@milken
Copy link

milken commented May 13, 2019

Hey there,
I'm using splitties and I wanted to use filledUnelevated MaterialButton, but I need to remove insetTop and insetBottom.

// create button with applied theme
private val materialStyles = MaterialComponentsStyles(ctx)
private val customButton = materialStyles.button.filledUnelevated(theme = R.style.PinButton)

// styles.xml
<style name="PinButton">
<item name="android:height">50dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
</style>

Unfortunately parameters from style are not applied. Maybe i'm doing something wrong, if there is a way to change inset values I would love some code. Otherwise, here is a bug

@LouisCAD
Copy link
Owner

Hi, xml styles don't support programmatic usage (unless you hack deep like I did to integrate styles from Material Components, as documented in Splitties Views DSL README). You need to set the insets programmatically, in Kotlin (or Java if you dare). Also, I don't think android:height is an existing attribute for view styles, maybe you are looking for minHeight/minimumHeight, or height from ViewGroup.LayoutParams?

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

No branches or pull requests

2 participants