Working in Eclipse, I am trying to put some italics text onto a layout. The problem is, that when I am setting
android: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!
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.