5

LinearLayout を使用するウィジェットを作成し、レイアウトに 2 つの TextView を配置しました。レイアウトの重心は「上」。

問題は、2 つの 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"
        />

ご覧のとおり、パディング 0 と verticalSpacing 0 を入れてみましたが、それらの間にまだスペースがあります。

どうすれば修正できますか?

ありがとう。

4

3 に答える 3

9

負のマージンを使用することもできます ( CSSのように:)

(私は自分のアプリでそれを行いましたが、うまく機能します)

<TextView
android:layout_marginTop="-10dp"
android:layout_marginBottom="0dp"
/>

お役に立てれば!

于 2010-10-06T09:21:46.443 に答える
0

一部の属性に dp の代わりに sp を使用しています。フォント サイズには sp のみを使用します。:)

于 2012-07-17T20:21:35.253 に答える
0

次のプロパティを設定してみてください。

<TextView
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
/>
于 2010-10-06T08:42:12.390 に答える