如何减少保证金?

时间:2011-06-01 05:57:54

标签: android android-layout android-xml

我的一个观点现在看起来像这样。靠近大5,特别是在它上面和下面,有相当大的余地。如何减少或消除此保证金?

enter image description here

相关的XML代码如下所示:

<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <TextView style="@style/medText" android:id="@+id/whenSee" android:text="@string/whenSee" android:layout_alignParentLeft="true" android:layout_above="@+id/newViewValue" android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
    <TextView style="@style/numberSelect" android:id="@+id/newViewValue" android:text="9" android:layout_above="@+id/press_text" android:layout_alignParentLeft="true"  android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
    <TextView style="@style/medText" android:id="@+id/press_text" android:layout_above="@+id/button_to_press" android:layout_alignParentLeft="true" android:text="@string/press"  android:gravity="center" android:layout_alignRight="@+id/button_to_press"></TextView>
</RelativeLayout>

样式在这里:

<style name="medText">
    <item name="android:textSize">22sp</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">wrap_content</item>
</style>
<style name="numberSelect">
    <item name="android:textSize">80sp</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">wrap_content</item>
</style>

2 个答案:

答案 0 :(得分:5)

将属性android:includeFontPadding="false"添加到大TextView,它必须缩小填充。

答案 1 :(得分:3)

我有一个类似的问题 - 两条线一个在另一条之上 - 两个很远。这是因为文本中留有空间,因此重音字符不会粘在上面的行中的'y'之类的符号上。 解决方案是使用负边距:-5px,-5dp。只需将它放在带有5的TextView上,因为这是最空白的地方。一方面你是安全的,因为只有数字。另一方面,你永远不会知道使用什么字体。 你也可以使用图像。

相关问题