斜体的TextView与wrap_contents似乎夹在右边的文字 [英] Italic TextView with wrap_contents seems to clip the text at right edge
问题描述
<TextView android:id="@+id/prodLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#FFFFFF"
android:textSize="30dip"
android:textStyle="italic"
android:text="Magnifico"
/>
好像剪辑几个像素从最右边的字符,至少在480×800仿真器或Nexus One的。
Seems to clip few pixels from the rightmost character, at least on 480x800 emulator or Nexus One.
要我来说,它看起来像一个错误,但我只是一个Android的初学者。 我尝试添加利润率左,右,但它仍然保留在剪裁。 最后我周围的黑客是添加在文本两侧有一个空格。 任何其他解决办法?
To me it looks like a bug, but I'm just an Android beginner. I tried to add margins to left and right, but it still kept on clipping. In the end my hack around it was to add a single space on both sides of the text. Any other solutions?
推荐答案
机器人:layout_width =WRAP_CONTENT
,为您提供包裹的内容呈现一个矩形。
一切都会很好的工作正常的文本(非斜体)。
android:layout_width="wrap_content"
, gives you a rectangle for wrapped content rendering.
All will work well for normal text (non-italic).
一旦斜体
启用文本时,换行文本会尝试融入矩形,因此最右边的字符将被切断,除非其未切能(如。
,)
, 1
等)
Once you have italic
text enabled, the wrapped text will try to fit into the rectangle and hence the rightmost character will be cut off unless its un-cut-able (such as .
, )
, 1
, etc.)
解决方案的建议是有在文本的后面加上一个空格(或更好的东西?)
Solution as suggested is to have a space at the end of the text (or anything better ??)
PS:的本机适用于安卓重力=太大,因为该文本将被推为right
最右边。如果我们有斜体
文本,我们所面临的同样的问题。
PS: This applies to android:gravity="right"
too because the text will be pushed to the rightmost. If we have italic
text, we face the same problem.
这篇关于斜体的TextView与wrap_contents似乎夹在右边的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!