Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Markdown渲染策略调整 #26

Closed
TakWolf opened this issue May 1, 2016 · 10 comments
Closed

Markdown渲染策略调整 #26

TakWolf opened this issue May 1, 2016 · 10 comments

Comments

@TakWolf
Copy link
Owner

TakWolf commented May 1, 2016

问题来源:
#7
#8
#25
#31

@TakWolf
Copy link
Owner Author

TakWolf commented May 1, 2016

目前客户端markdown渲染使用webview来实现,存在以下问题:

1.ListView中每个item都是webview,滚动回收造成item重用使webview不断重复加载,造成页面跳动 #25 #31
2.跟1相同的原因,在部分手机上,被拉长的webview无法缩短 #8
3.不同版本手机样式存在细微差别 #7

以上问题,目前没有有效的解决手段

@TakWolf
Copy link
Owner Author

TakWolf commented May 1, 2016

一种可选方案:使用原生TextView通过SpannableString实现富文本渲染,存在以下问题:

1.网络图片加载存在问题,试了几种方法都无法解决该问题
2.无法支持复杂css样式,主要影响到图片和代码的显示样式
3.实现代码复杂,扩展难度大

@TakWolf
Copy link
Owner Author

TakWolf commented May 1, 2016

一种可选方案:仍然使用webview,但是把ListView替换为scrollview

这样相当于初始化的时候,一次性实例化所以内容,全部放到页面中,并且不适用重用
该方案可以有效解决由于item回收造成的webview的诸多问题,但是会有更严重的内存占用问题,非常容易产生oom

@TakWolf
Copy link
Owner Author

TakWolf commented May 1, 2016

一种可选方案:原来的ListView页面,改为使用两个webview来实现渲染,分别是header和replylist

该方案可以有效解决由于item回收造成的webview的诸多问题
问题是引入了较多web解决方案,包括非常多ui部分,这里可能会跟其他原生部分的显示样式造成差异;web跟原生代码的通信机制也比较复杂

@TakWolf
Copy link
Owner Author

TakWolf commented May 1, 2016

一种可选方案:话题详情页面item不支持富文本

这样没有了webview也就没有了诸多问题,但是会造成功能缺失。

@TakWolf
Copy link
Owner Author

TakWolf commented May 1, 2016

一种可选方案:自己扩展view从底层重新实现渲染,或者通过源码自己引入webview替代系统内置

简直作死!!!

@XGHeaven
Copy link

XGHeaven commented May 1, 2016

提一个想法。就是类似知乎。分两部分。对于评论,可以显示一个纯文字的概要,然后点击进去查看详细。对于文章主体,我建议将md的格式进行分析,分析出里面的图片,标题,加粗什么的。然后分别用原生方式实现。很喜欢md设计里面标题悬浮的感觉

TakWolf notifications@github.com于2016年5月1日周日 16:36写道:

一种可选方案:自己扩展view从底层重新实现渲染,或者通过源码自己引入webview替代系统内置

简直作死!!!


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#26 (comment)

@TakWolf
Copy link
Owner Author

TakWolf commented May 9, 2016

尝试解决这个问题,方案在:https://github.com/TakWolf/CNodeMD-Page-Render-Compat

@TakWolf
Copy link
Owner Author

TakWolf commented May 14, 2016

finish by 05664b8

@TakWolf
Copy link
Owner Author

TakWolf commented May 14, 2016

该问题已经通过 #34 解决

@TakWolf TakWolf closed this as completed May 14, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants