From 6fa05b0748f6cefa5a7e5390997ff130a70a2268 Mon Sep 17 00:00:00 2001 From: Skalii Date: Tue, 26 Jan 2021 04:02:49 +0200 Subject: [PATCH] fix padding between title and input text if title has more than one line --- .../plus/widgets/OsmandTextFieldBoxes.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java index bbc94d126e..45eb6a703b 100644 --- a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java +++ b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java @@ -3,7 +3,6 @@ package net.osmand.plus.widgets; import android.content.Context; import android.util.AttributeSet; import android.view.View; -import android.widget.RelativeLayout; import net.osmand.plus.R; @@ -38,9 +37,18 @@ public class OsmandTextFieldBoxes extends TextFieldBoxes { @Override public void setLabelText(String labelText) { super.setLabelText(labelText); - if (!floatingLabel.isSingleLine()) { - RelativeLayout.LayoutParams rl = (RelativeLayout.LayoutParams) floatingLabel.getLayoutParams(); - rl.bottomMargin = rl.topMargin; - } + floatingLabel.post(new Runnable() { + @Override + public void run() { + if (floatingLabel.getLineCount() > 1) { + inputLayout.setPadding( + inputLayout.getPaddingLeft(), + inputLayout.getPaddingTop() + getResources().getDimensionPixelSize(R.dimen.pages_item_padding), + inputLayout.getPaddingRight(), + inputLayout.getPaddingBottom() + ); + } + } + }); } }