我有一個xml文件,我想加載xml內容到一個web視圖,其中web視圖將充氣到一個畫廊。我已經解析並能夠獲得解析的值,但是如何將XML內容加載到Web視圖?我對此毫無頭緒。請有人幫助我。如何加載到web視圖的xml android
3
A
回答
3
我認爲你需要顯示標籤內容,
然後分析XML,並顯示網頁流量爲:
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadDataWithBaseURL(null, myPreviewContents, mime, encoding, null);
其中myPreviewContents
是:
<p>Early in my career I took responsibility for managing people. I managed up to 250 highly trained professionals who worked as a tight-knit team. It didn’t matter that I was the youngest person in the team! For over 20 years I’ve been working with individuals and organizations to help them improve their management of people. This has ranged from military personnel to entrepreneurs, from charities to government departments. I’ve learned many secrets and tricks over these years. Some I’ve discovered for myself, but many I’ve learned from others. Humans are wonderfully inventive!</p>
<p>This book aims to help you improve your skills at managing people – to help you find ways in which everybody benefits. It contains 50 secrets, grouped into seven themed chapters.</p>
<p>
<ul>
<li>
<span class='pointHeading'>Build on a strong foundation.</span><span class='normalText'>You must understand what type of leader or manager you want to be. Your employer may give guidelines, but you must exert control over your day-to-day behaviour.</span>
</li>
<li>
<span class='pointHeading'>Create a great team.</span><span class='normalText'>This shows how to choose the right people and quickly build a functioning team.</span>
</li>
<li>
<span class='pointHeading'>Set goals and targets.</span><span class='normalText'>By setting people effective targets and goals, you can monitor progress and offer appropriate rewards.</span>
</li>
<li>
<span class='pointHeading'>Motivate yourself and your people.</span><span class='normalText'>Implementing ways to motivate people is ultimately much easier than having to cajole and constantly monitor unmotivated people.</span>
</li>
<li>
<span class='pointHeading'>Manage good performance.</span><span class='normalText'>You need to recognize good performance – reward it, develop it, perpetuate it and spread it to others. Otherwise you will lose your good performers and be left only with the poor ones.</span>
</li>
<li>
<span class='pointHeading'>Manage poor performance.</span><span class='normalText'>Some managers find ways of managing around poor performance without tackling the poor performance itself. However, this encourages more poor performance, from both the original perpetrator and everyone else. Know how to tackle the problems head on.</span>
</li>
<li>
<span class='pointHeading'>Develop your people.</span><span class='normalText'>Though often overlooked by managers, another fundamental task is developing people. You need to improve the less able, stretch and reward the able, plan succession for the future and mentor your people’s changing needs. </span>
</li>
</ul>
</p>
<p>Managing people is a hugely complex area in which you never stop learning. The secrets contained in this book will help you make massive strides towards succeeding in this fascinating role.</p>
]]>
+0
非常感謝..這幫了我 – cavallo
0
A xml
文件並不總是一個網頁。你必須給在loadUrl()
有效的網頁就像
wv.loadUrl("http://www.bbc.co.uk"");
或者使用這就是你有原始的HTML:
String summary = "<html><body>You scored <b>192</b> points.</body></html>";
webview.loadData(summary, "text/html", null);
(是的,Android使用XML文件爲它的UI它充氣,使用瀏覽XML作爲骨架)
0
您可以使用XSL來轉換XML,然後加載生成的串入webivew(webview.loaddata,我相信)。
參見Android: Convert xml using xslt例如轉換xml。
0
請按照this關於XML解析的android開發者教程,下載示例代碼並根據你的XML文件修改它。它首先解析一個XML,然後創建一個HTML代碼字符串,最後在一個簡單的webView中呈現這個HTML字符串。
相關問題
- 1. Android在Web視圖中加載圖像
- 2. 加載一個XML到類視圖
- 3. Android - 如何通過cookie來加載與web視圖的網址?
- 4. 如何在android中的diaoge中加載web視圖
- 5. Android:如何減少列表視圖中的web視圖的加載時間?
- 6. Android:將按鈕添加到XML Web視圖
- 7. 如何在Web視圖加載網頁時看到加載的網頁?
- 8. web視圖不加載url
- 9. 無法加載XML視圖
- 10. 我可以加載本地sdcard文件到web視圖中android
- 11. 使用拆分視圖如何加載詳細視圖中的web視圖
- 12. 加載HTML網址(Flash視頻)到特定大小的Web視圖Android
- 13. 如何在XML視圖中動態加載XML片段?
- 14. Android,在web視圖中加載mp4視頻
- 15. 如何在表視圖的末尾加載加載視圖?
- 16. 如何將.nib加載到視圖中?
- 17. 如何在android web視圖中使用空間名稱加載圖像文件?
- 18. 如何顯示啓動圖像,直到我的web視圖加載結束?
- 19. 如何將數據加載到已加載的視圖?
- 20. 如何從Web視圖加載插頁式廣告
- 21. Web視圖的Android
- 22. 如何從視圖加載視圖?
- 23. 從庫加載視圖Android
- 24. 如何添加Web視圖列表視圖與例如
- 25. 如何從web視圖中的Android
- 26. 在Web視圖中加載Url
- 27. 如何將視圖添加到backstack(android)?
- 28. 如何將子視圖添加到Android
- 29. 在android中加載2個單個活動的Web視圖
- 30. 無法在web視圖與SWF加載HTML中的Android
你想要什麼? –