Splitties icon indicating copy to clipboard operation
Splitties copied to clipboard

Style set to MaterialButton has no effect

Open milken opened this issue 6 years ago • 1 comments

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

milken avatar May 13 '19 18:05 milken

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?

LouisCAD avatar May 13 '19 20:05 LouisCAD