I want to set the top padding of a textview programmatically. I know you can do this with the method setPadding(). But the problem is that this method requires 4 parameters: left, top, right, bottom. I don't want to change the left, right and bottom, I just want to change the top padding.
Is that possible?
use
yourTextView.setPadding(0, 10, 0, 0);
Adjust only the parameters you need and set the other ones to zero.
If you need to preserve other existing paddings, use yourView.getPaddingLeft()
, yourView.getPaddingTop()
and so on.