我有 1 英寸高的文本,但视图框占用 1.5 英寸,因此白色字体上方和下方有 1/4 英寸的黑色空间。我想减少 1/4 英寸,这样我就可以在 6 英寸屏幕上显示 5 行文本,而不是 4 行。我可以使用 android:lineSpacingMultiplier=".66" 将它们移得更近,但这只会将框移得更近在一起,1/4 英寸的黑色空间覆盖了附近行的文本。 android:includeFontPadding="false" 什么也不做。负填充没有任何作用。放入 android:lineSpacingExtra="-50sp" 也只会让黑色边距覆盖相邻的文本行。我想去掉边距(实际上,只是大部分)。
我已经尝试了我能想到的所有选项,包括上面讨论的明显的填充和边距以及填充,包括零和负数。我找不到一个简单的图表来显示控制实际文本上方视图中的空间的因素。
如何减少这种浪费的空间?
(我的网络在过去 2 小时内中断,所以我花了一些时间才回复。抱歉)
这是我的 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>
在此屏幕截图中,您可以看到喜欢的边框或边距是我要减少的区域。
一些负的顶部和底部边距。但如果你有精美的背景,事情就会变得混乱。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)