2012-12-25 30 views

回答

1

創建一個TextView文本區域,並設置它的文本與HTML字符串 您可以使用HTML標籤定義字符串的strings.xml文件的一部分,並確保您撥打的getText(T.string.your_html_string)獲取的HTML基於文本

<string name="your_html_text">"Press <font fgcolor="#ffffffff"><b>Menu</b></font> and touch:\n 
    \n<li><font fgcolor="#ffffffff"><b>Create </b></font> to create\n</li> 
    \n<li><font fgcolor="#ffffffff"><b>Delete All</b></font> to delete all\n</li> 
    </string> 

和的setText等

textArea.setText(的getText(R.string.your_html_text));

2

把你的文件,以資產文件夾後,可以使用下面的代碼

WebView webview = (WebView) findViewById(R.id.yourwebview); 
    webview .loadUrl("file:///android_asset/UI/mylocalhtmlfile.htm"); 
1

最簡單的方法很可能是把你的網絡資源到資產的文件夾中,然後調用

webView.loadUrl("file:///android_asset/filename.html"); 
2

使用這個。

yourWebView.loadUrl("file:///android_asset/yourfileName.html"); 
+0

注意:「file:/// android_asset」位於「<項目文件夾名稱>/assets」 – renedet

相關問題