Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No setPadding programmatically for TableRow?

I'm such new in Android and I would like to setPadding programmatically for a TableRow, I can have in my layout :

<TableRow
    android:padding="15dp" >

It looks that the Margin can be setted programmatically by setMargin however it looks that programmatically the TableRow object doesn't have a setPadding Method... Is there any method to set a padding to a tableRow programmatically ??

Thank you.


1 Answers

The TableRow class, as with all View subclasses, indeed has a setPadding method.

However, since you mention that you found setMargin, I believe you are looking at the TableRow.LayoutParams instead of the TableRow itself.

Margins are set in a View's LayoutParams, whereas padding is set on the View.

like image 163
Bryan Herbst Avatar answered Mar 21 '26 10:03

Bryan Herbst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!