简体   繁体   English

Android:在应用程序中显示大量带格式的文本

[英]Android: Display large amount of formatted text in an app

I am creating an informative application for school students I am having all the contents in word file which is formatted. 我正在为学校学生创建一个信息丰富的应用程序,我将所有内容都格式化为word文件。 It contains tables and various styles of fonts,spacing and new lines in it. 它包含表格和各种样式的字体,间距和换行符。 Can some one tell me how can i display this content in an android application. 有人可以告诉我如何在android应用程序中显示此内容。 Or is there any way to display the word file as it is. 还是有什么办法可以直接显示单词文件。 Thanks in advance 提前致谢

you may upload all your files on server and view directly using webview you need to approach like this 您可以将所有文件上传到服务器上,然后使用webview直接查看

WebView urlWebView = (WebView)findViewById(R.id.containWebView);
urlWebView.setWebViewClient(new AppWebViewClients());
urlWebView.getSettings().setJavaScriptEnabled(true);
urlWebView.getSettings().setUseWideViewPort(true);
urlWebView.loadUrl("http://docs.google.com/gview?embedded=true&url="
                + "YOUR_DOC_URL_HERE"); 

public class AppWebViewClients extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        // TODO Auto-generated method stub
        view.loadUrl(url);
        return true;
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        // TODO Auto-generated method stub
        super.onPageFinished(view, url);
    }
  }

我有一个解决方案,我已经将我的word文件在线转换为HTML文件,然后使用webview容器显示了它,谢谢大家的帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM