themed-toggle-button-group
themed-toggle-button-group copied to clipboard
ThemedButton width problems when different textSize
How can I make all my ThemedButton have the same width with different textSize ?
Note: My ThemedToggleButtonGroup is set to app:flexDirection="column"
I'm assuming you can't get this to work because by default the buttons are set to wrap_content. Unfortunately you can only change that programmatically at the moment. So give each button the same app:layout_maxWidth
(or set it to app:flexGrow="1"
) and then change the buttons' width to match_parent:
themedToggleButtonGroup.buttons.forEach { btn ->
btn.applyToCards {
it.layoutParams = RelativeLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
}
}
![]() |
I tried your solution and it works very well, thank you! This lib is great. If you can allow this function to be added through XML code, it would be really awesome. Good coding.
I will reopen this because it's still in todo.
Nice !