我该如何减少文本周围的填充在Android的XML布局?

问题描述:

予有1英寸高的文本,但视图的框占用1.5英寸所以有1/4英寸的上方和下方的白色字母黑色空间。我要减少1/4英寸,这样我可以得到5行文字,我的6英寸屏幕上,而不是仅仅4,我可以与Android移动它们紧密地结合在一起:66lineSpacingMultiplier =但这只是移动的盒子接近一起和1/4英寸的黑色空间覆盖了附近的行的文本。机器人:includeFontPadding =假什么都不做。负填充什么都不做。把在机器人:lineSpacingExtra = - 50SP也只是有黑缘封面文本的相邻行。我想摆脱保证金(实际上,只是大部分)。

I have 1 inch high text but the box of the view takes up 1.5 inches so there is 1/4 inch of black space above and below the white lettering. I want to reduce that 1/4 inch so that I can get 5 lines of text on my 6 inch screen instead of just 4. I can move them closer together with android:lineSpacingMultiplier=".66" but this just moves the boxes closer together and the 1/4 inch of black space covers the text of the nearby line. android:includeFontPadding="false" does nothing. Negative padding does nothing. Putting in android:lineSpacingExtra="-50sp" also just has the black margin cover the adjacent line of text. I want to get rid of the margin (actually, just most of it).

我已经想尽选择,我能想到的,包括填充和边距和填充的显而易见的上面,包括零和负数讨论。我找不到展示什么控制在上面的实际文本视图中的空间,一个简单的图表。

I have tried every option I can think of including the obvious ones of padding and margins and padding discussed above including zero and negative numbers. I can't find a simple diagram showing what controls the space in a view above the actual text.

我如何减少这种浪费的空间?

How do I reduce this wasted space?

(我的互联网下跌了近2小时,我花了一些时间来作出回应。对不起)

(my internet was down for the last 2 hours so it took me some time to respond. Sorry)

下面是我的XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:id="@+id/textTimer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.01"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />


<TextView
    android:id="@+id/textTimeToLine"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimer"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.02"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

<TextView
    android:id="@+id/textTimeToKill"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimeToLine"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.03"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

<TextView
    android:id="@+id/textTimeToPin"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimeToKill"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.03"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

<TextView
    android:id="@+id/textTimeToCB"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimeToPin"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.03"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

    <Button
    android:id="@+id/buttonMenu"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:text="Menu" 
    android:onClick="onMenu"
    android:focusable="false"/>

</RelativeLayout>

在这个屏幕截图中,可以看到边框或保证金周围的喜爱是我想要减低区。

In this screen shot, you can see that the border or margin around the fond is the area I want to reduce.

一些负面的顶部和底部边缘。事情变得复杂但如果你有看中的背景。

Some negative top and bottom margin. Things get messy though if you have fancy backgrounds.