Remove space between stacked TextViews
android, android-layout, textview
Solution
Try using negative margins. It may take a bit of playing with the numbers to get it right, but I've done it before and it worked out well.
android:layout_marginTop="-5dp"
Problem
I have a vertical `LinearLayout` with two `TextView` inside it. The former contains a static text property (it's text never change) and the last contains a regressive timer. The image below shows both items: I want to eliminate the blank space that both texts have both top and bottom. I've tried several approaches... ``` android:includeFontPadding="false" android:lineSpacingMultiplier="1" android:lineSpacingExtra="0dp" android:paddingTop="0dp" android:paddingBottom="0dp" android:layout_marginTop="0dp" android:layout_marginBottom="0dp" ``` ...but none of them removed the space above the text. How can I make both texts close to each other without any extra space? PS: I've found this similar question, but no one answered it. Full layout code: ``` <LinearLayout android:id="@+id/boxTime" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" > <TextView android:id="@+id/textRemainingTime2" android:layout_width="wrap_content" android:layout_heigh="wrap_content" android:layout_gravity="center" android:gravity="center_horizontal" android:textSize="70sp" android:includeFontPadding="false" android:lineSpacingMultiplier="1" android:lineSpacingExtra="0dp" android:paddingTop="0dp" android:paddingBottom="0dp" android:layout_marginTop="0dp" android:layout_marginBottom="0dp" android:text="@string/title" /> <TextView android:id="@+id/textRemainingTime" android:layout_width="wrap_content" android:layout_heigh="wrap_content" android:layout_gravity="center" android:gravity="center_horizontal" android:includeFontPadding="false" android:lineSpacingMultiplier="1" android:lineSpacingExtra="0dp" android:paddingTop="0dp" android:paddingBottom="0dp" android:layout_marginTop="0dp" android:layout_marginBottom="0dp" android:textSize="107sp" android:text="@string/timer" /> </LinearLayout> ```