themed-toggle-button-group icon indicating copy to clipboard operation
themed-toggle-button-group copied to clipboard

ThemedButton width problems when different textSize

Open gabriel-TheCode opened this issue 4 years ago • 4 comments

How can I make all my ThemedButton have the same width with different textSize ? Note: My ThemedToggleButtonGroup is set to app:flexDirection="column"

gabriel-TheCode avatar Jun 17 '20 14:06 gabriel-TheCode

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) 
  }
}

Bryanx avatar Jun 18 '20 21:06 Bryanx

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.

gabriel-TheCode avatar Jun 19 '20 19:06 gabriel-TheCode

I will reopen this because it's still in todo.

Bryanx avatar Jul 02 '20 19:07 Bryanx

Nice !

gabriel-TheCode avatar Jul 02 '20 19:07 gabriel-TheCode