2011-06-01 35 views
3

我的一個觀點現在看起來像這樣。在大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> 

回答

5

將屬性android:includeFontPadding="false"添加到大TextView,它必須縮小填充。

3

我有一個類似的問題 - 兩條線一個在另一個之上 - 兩個遠處。這是因爲文本中留有空白,以致重音字符不會像上面的線條那樣粘在符號「y」上。 解決方案是使用負邊距:-5px,-5dp。只需在TextView中使用5,因爲這是最空白的地方。一方面你是安全的,因爲只有數字。另一方面,你永遠不會知道使用什麼字體。 您也可以使用圖像。