【发布时间】:2012-08-31 00:55:13
【问题描述】:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/htmlText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFCC00" />
</FrameLayout>
如果我这样设置 textview 的文本:
setText(Html.fromHtml(htmlString));
滚动不起作用。 此外,如果在 html 中有一个 img 标签,则无法查看图像..为什么?
编辑:
我切换到 webview:
WebView view = (WebView)findViewById(R.id.newsView);
view.loadData(htmlString,"text/html","UTF-8");
现在我解决了这些问题,但我还有其他问题:
1)如何设置透明背景以便我可以看到我的应用?
2)如何设置前景文本颜色,以便再次看到我的应用的颜色?
3)如果有一个img标签图片不适合视图,导致水平滚动。相反,文本完美填充。
【问题讨论】:
-
1.见stackoverflow.com/q/5003156/1321873 2. 使用HTML 格式设置 3. 见stackoverflow.com/q/3099344/1321873