Android和IOS打开文档

IOS:WKWebView直接打开
Android:腾讯X5内核

TbsReaderView mTbsReaderView = new TbsReaderView(this, this);
RelativeLayout mRelativeLayout = findViewById(R.id.tbsViewContainer);
mRelativeLayout.addView(mTbsReaderView, new RelativeLayout.LayoutParams(-1, -1));

Bundle localBundle = new Bundle();
localBundle.putString("filePath", "/data/data/com.example.demo/files/1.xlsx");
localBundle.putString("tempPath", "/data/data/com.example.demo/files/TbsReaderTemp");

boolean bool = mTbsReaderView.preOpen(getFileType("/data/data/com.example.demo/files/1.xlsx"), false);
if (bool) {
    mTbsReaderView.openFile(localBundle);
}

你可能感兴趣的:(Tuhuolong)