I'm creating an app with 3 buttons, start, stop, and reset. They are all in a line and the centering would look a lot better and the app would be easier to use if all three buttons were the same width. However, I don't want to hardcode their width because if I make them all the width of the 'reset' button, then if I ever internationalize I'm potentially borked.
So, I tried having the layout XML have all 3 buttons use the longest string, and then had onCreate() rename the buttons but then they get resized. Similarly, if onCreate tries to use getWidth() to change the size later it fails because the buttons have not been drawn yet so their width is 0.
There are some terribly hacky ways to do this, such as creating a custom view, overriding its onSizeChanged and having it remember it's largest width and always maintain it. But there has to be a smarter way, which when I see will make me feel like an idiot.
So, I emplore: Make me feel dumb.