Tried to find out how to create ToggleButton in Sp...
# splitties
i
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
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
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.