My question is very simple, I am trying to dynamically change the width of this button:
Button> android: layout_height = "35dip" android: background = "@ drawable / buttonlesson" android: text = "Level 3 [TAP HERE]" android: onClick = "MenuLI1L3" android: layout_width = "300dp" android: ID = " @ + identifier / II 3 "> / Button"
Here is the code I'm using:
Button myButton = (Button) findViewById(R.id.II3);
myButton.setWidth(10);
myButton.setText("kl");
The text does change, but not the width. It sounds like there is a mistake. There is another button on the right panel that allows you to fill in the gap when this button is reduced to 10 pixels, so I also canβt change the Linringayout.
Any explanations and solutions? shouldn't it work? thank
source
share