0

I'm filling the contents of a TextView from an HTML source using Html.fromHtml method, but the text appears to be italic for some reason and the first few letters are clipped. I tried .clearComposingText() and that didn't help.

Any idea why?

Here's the bastard:

    <RelativeLayout android:layout_width="match_parent" android:layout_height="120dip" android:duplicateParentState="false">
        <ScrollView android:layout_width="match_parent" android:layout_height="120dip" android:layout_alignParentLeft="true" android:layout_alignParentTop="true">
            <TextView android:id="@+id/textDetailsScrollable" android:textStyle="normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dip" android:paddingRight="10dip" />
        </ScrollView>
        <ProgressBar android:layout_height="15dip" android:id="@+id/loadingExtendedData" android:layout_width="15dip" android:indeterminateOnly="true" android:layout_centerInParent="true" />
    </RelativeLayout>

(It's not the ScrollView, I tried removing it and it didn't work, neither did padding on any of the elements).

4

1 回答 1

0

学到了艰难的方法:永远不要在 ANDROID 中使用斜体文本。如果您想去除 HTML 标记,请使用String.replaceAll("<(.|\n)*?>", "").

于 2012-04-24T07:38:13.083 回答