如何摆脱LinearLayout中的额外间距?

Ran*_*Ran 5 android spaces android-linearlayout

我已经构建了一个使用LinearLayout的小部件,并且我在布局中放置了两个TextView.布局的重力是"顶部".

问题是我在两个TextView之间得到了一个空间,我无法摆脱它.

    <TextView 
        android:id="@+id/Text01"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:gravity="bottom|center_horizontal" 
        android:text="blah blah"
        android:background="@android:color/transparent"
        android:textColor="#3e6eb4"
        android:textSize="11sp"
        />        

    <TextView 
        android:id="@+id/text02"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:gravity="top|center_horizontal" 
        android:text=""
        android:background="@android:color/transparent"
        android:textColor="#3e6eb4"
        android:textSize="14sp"
        android:padding="0sp"
        android:verticalSpacing="0sp"
        />
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我尝试将padding 0和verticalSpacing 0放在一起,但我仍然在它们之间留一个空格.

我该如何解决?

谢谢.

Lio*_*luz 9

您也可以尝试使用负边距(就像CSS :)

(我用我的应用程序做到了,效果很好)

<TextView
android:layout_marginTop="-10dp"
android:layout_marginBottom="0dp"
/>
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!