I have a few buttons with different text length. I'd like to make all buttons equal to the button with the longest text. Their width is
android:layout_width="wrap_content"
So the buttons have different width.
I tried
int width=button1.getWidth();
button2.setWidth(width)
But they don't match each other. The width of button2 is different. GetWidth gets I don't know what. SetWidth sets pixels.
I don't want to use weight, because no guarantee that the text of button will be as one line text. I don't want to set exact width of buttons, because there will be extra space on the left and on the right from button's text.
Any ideas please? Thanks!