How to set TextView layout_gravity by code?
I tried with layoutparams without a good result.
new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, Gravity.LEFT | Gravity.CENTER_VERTICAL);
After that, my text remains where it is standard in the upper left corner. Neither the width: FILL_PARENT nor the gravity codes do anything.
source share