开始都是用html.fromhtml(source);来显示html的
但是你会发现,对于style,table等等一系列的标签它都没有解析的
只好换一个思路,用webview去做
在xml中加入
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
然后在activity中
WebView wView = (WebView)findViewById(R.id.wv1);
wView.getSettings().setDefaultTextEncodingName("UTF -8");
wView.loadData(source, "text/html; charset=UTF-8", null);
这样就可以了
版权声明:本文为博主原创文章,未经博主允许不得转载。
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号