Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThemedButton width problems when different textSize #6

Open
gabriel-TheCode opened this issue Jun 17, 2020 · 4 comments
Open

ThemedButton width problems when different textSize #6

gabriel-TheCode opened this issue Jun 17, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@gabriel-TheCode
Copy link

gabriel-TheCode commented Jun 17, 2020

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

@Bryanx
Copy link
Owner

Bryanx commented Jun 18, 2020

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

@gabriel-TheCode
Copy link
Author

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.

@Bryanx
Copy link
Owner

Bryanx commented Jul 2, 2020

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

@Bryanx Bryanx reopened this Jul 2, 2020
@Bryanx Bryanx added the enhancement New feature or request label Jul 2, 2020
@gabriel-TheCode
Copy link
Author

Nice !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants