TextView在文本的上方和下方占用/消耗太多空间

时间:2013-05-18 17:47:48

标签: android android-layout textview android-textattributes

enter image description here

圈出的文字视图在文字的上方和下方有太多空间。它位于文本视图内(不在其上方和下方)。我既没有使用边距也没有填充,但它仍然存在。那里有xml代码。

    <TableRow
        android:id="@+id/tbRow"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewLineSeparator"
        android:layout_gravity="top"
        android:layout_marginBottom="2dp"
        android:layout_marginTop="1dp"
        android:gravity="top"
        android:weightSum="1.0" >
        <TextView
            android:id="@+id/tvReportAsAdult"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="left|top"
            android:layout_weight="0.60"
            android:clickable="true"
            android:gravity="left|top"
            android:maxLines="5"
            android:padding="11dp"
            android:text="@string/txtReportAsAdultText"
            android:textColor="#00BFFF"
            android:textSize="18sp" />
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="right|center"
            android:layout_weight="0.40"
            android:gravity="center"
            android:weightSum="1.0" >

            <ImageButton />
            <ImageButton />
            <ImageButton />
            <ImageButton />

        </LinearLayout>
    </TableRow>

此tableRow是RelativeLayout的子项,它还是ScrollView的子项。而这个空间只是由于textview,即它既不是图像视图也不是桌面视图。

1 个答案:

答案 0 :(得分:1)

您正在使用

  android:padding="11dp"

在textview的所有边设置11 dp填充。使用

单独使用填充

paddingToppaddingBottompaddingLeftPaddingRight

相关问题