slt user slt user - 2 months ago 18
Android Question

How do I edit properties of components?

Let's say I have a button. How would I programmatically edit its properties? I don't want to change the properties using XML code in the layout.

Answer

Declare your Button variable:

Button button;
...

Then write the following in your onCreate() method:

button = (Button) findViewById(R.id.<Your buttons ID>);
button.setHeight(50);

Please rather do research before asking questions.