I want to remove extra padding from top and bottom of TextView. I try setIncludeFontPadding(false); and also this:
android:layout_marginTop="-Xdp"
android:layout_marginBottom="-Xdp
But they didn't work.
Is there any way to do that?
I want to remove extra padding from top and bottom of TextView. I try setIncludeFontPadding(false); and also this:
android:layout_marginTop="-Xdp"
android:layout_marginBottom="-Xdp
But they didn't work.
Is there any way to do that?
setIncludeFontPadding works but it doesn't remove all padding, Specially when you wrap your text view size.
Create a custom TextView and override onDraw method then add these lines before calling super:
@Override
protected void onDraw(Canvas canvas) {
float offset = getTextSize() - getLineHeight();
canvas.translate(0, -offset); //or +offset to moving it to top
super.onDraw(canvas);
}