首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >安卓EditText替代方案

安卓EditText替代方案
EN

Stack Overflow用户
提问于 2015-04-23 22:49:21
回答 4查看 3.1K关注 0票数 19

目前,在处理大量文本行(10000+)时,Android的EditText速度非常慢。看起来,这种减速的部分原因是EditText支持跨度,主要是因为EditText计算每一行的宽度,这是非常昂贵的。有没有比EditText更快的替代品,或者有一种方法可以优化它,使它变得可用?

编辑:方法跟踪如下:

android.text.StaticLayout.generate: 99.1% CPU time inclusive, 8.8% exclusive (1 call)
    android.text.Layout.getParagraphSpans: 28% inclusive, 1.1% exclusive (4686 calls)
    android.text.MeasuredText.setPara: 20.6% inclusive, 1.6% exclusive (2343 calls)
    android.text.MeasuredText.addStyleRun: 18.6% inclusive, 1.1& exclusive (2343 calls)
    android.text.SpannableStringBuilder.getSpans: 15% inclusive (of parent calls), 56.7% inclusive (of all calls, 47.3% of which are from android.text.Layout.getParagraphSpans, 26% are from android.text.MeasuredText.setPara, 26% are from android.text.StaticLayout.generate)
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29827029

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档