如何使斜体 TextView 在 Eclipse 图形布局视图中工作?它甚至挂断了电脑
在 Eclipse 中工作,我试图将一些斜体文本放到布局上。问题是,当我设置时 android:textStyle="italic"
,文本消失。 (内容的高度变为 0,整个 TextView 变得不可见。)粗体工作正常。我已经尝试了每种字体,但结果都是一样的。
在设备上,它以斜体显示,OK。但布局非常复杂,看不见的设计也变得非常复杂。
这里的TextView
<TextView
android:id="@+id/smallEpgNextProgramTime"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:layout_margin="10dp"
android:gravity="left|top"
android:textSize="35dp"
android:typeface="monospace"
android:textStyle="italic"
android:text="12:00-13:11"
/>
Android版本是2.3.3。 Eclipse 版本是 2.6。
情况更糟。如果我将斜体留在那里,在将布局视图更改为图形并返回文本后,Eclipse 的运行速度会越来越慢,并且会挂起 PC。因此,我必须将其设置为布局中的“正常”并通过代码设置 textStyle。这是一个坏错误!
Working in Eclipse, I am trying to put some italics text onto a layout. The problem is, that when I am settingandroid:textStyle="italic"
, the text disappears. (The height of content becomes 0 and the whole TextView becomes invisible.) Bold works OK. I have tried every typeface, but the result is the same.
On the device it shows itself in italics OK. But the layout is very complicated and its design without seeing it becomes very complicated, too.
Here is the TextView
<TextView
android:id="@+id/smallEpgNextProgramTime"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:layout_margin="10dp"
android:gravity="left|top"
android:textSize="35dp"
android:typeface="monospace"
android:textStyle="italic"
android:text="12:00-13:11"
/>
Android version is 2.3.3. Eclipse version is 2.6.
It is even worse. If I leave italics there, after some changes of layout view to graphics and back to text, Eclipse works slower and slower and hangs up the PC. So, I have to put it as "normal" in layout and to set textStyle by code. A bad bug it is!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这是一个android平台问题。
请参阅问题 22867:使用斜体文本样式时布局预览不正确
它不会显示在布局的图形表示上,但在构建和运行应用程序时可以正常工作。
更新:
如果您想预览设计 xml 布局,则只需使用
此
android:textStyle="italic"
即可。文本将在图形布局编辑器中以斜体样式显示。它仅适用于这种衬线字体。
I think its an android platform issue.
Look at Issue 22867: Incorrect layout preview when ITALIC text style used
It doesn't show up on the layout's graphical representation but works correctly when you build and run the app.
Update:
If you want to preview for designing xml layout then just use
In this
android:textStyle="italic"
works. And text will displayed in italic style in graphical layout editor.Its only works for this serif typeface.
你写的内容是100%正确的,如果你想用代码编写,你可以使用这个..
What u wrote is 100% correct if you want to write in code you can use this..