https://kotlinlang.org logo
#splitties
Title
# splitties
i

ispbox

08/17/2019, 11:04 AM
Tried to find out how to create ToggleButton in Splitties, and the only way I've found is view(::ToggleButton). That is not so common widget, so I guess it is OK. But the question is with basic samples:
Copy code
val launchDemoBtn = button {
    textResource = R.string.go_to_the_demo
}
It doesn't work for me - just empty space is shown, and no errors. I didn't notice this initially because I started right from AppCompat samples (they work pretty well :))
According to styles (
Widget.Button.Toggle
), ToggleButton is not available in AppCompat.
l

louiscad

08/18/2019, 3:35 AM
Empty space is Susan l shown instead of the view? Can you check the layout parameters? Defaults to match contraints in ConstraintLayout FYI, so could be shrinked to zero if not constraints to expand.
i

ispbox

08/18/2019, 9:09 AM
I dig deeper and found that actually that is because of styles - there is an exception "This component requires that you specify a valid TextAppearance attribute. Update your app theme to inherit from Theme.MaterialComponents (or a descendant)."
And my theme parent is actually
parent="Theme.AppCompat.Light.NoActionBar"
. If I change it to
Theme.MaterialComponents.Light.NoActionBar
everything goes right. My fault.
2 Views