- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有纯文本数据,根据间距行等格式化。但我想将此文本显示为 HTML?如何才能做到这一点。
[American Thinker]
March 1, 2016
[American Thinker] [Navigation Menu]
HomeArchivesVideoCartoonsAboutSearchLoginRules/FAQContactDonations
Merchandise <http://www.americanmethod.com/american-thinker/>
Home Archives Video Cartoons About Search Login More [Down Arrow]
* Rules/FAQ
* Contact
* Donations
* Merchandise <http://www.americanmethod.com/american-thinker/>
American Thinker Blog
Mexican oil giant devastated by oil price decline - 3/1/16 March 1, 2016
The state owned oil company that provides one third of the revenue of the
Mexican government is in a deep crisis, owing to low oil prices,
我想像在网络上的 stackoverflow 上显示的那样显示。
问题是,当我把它放在一个段落中时,它看起来都串在一起了。
支持相反的操作 Html.fromHtml(htmlString),但如何将文本转换为 HTML 中正确显示的内容?在我发布之前没有想到它,但真的希望它看起来就像这个编辑文本。
更新:
<PRE> </PRE>
做了一些我想要的但现在没有发生换行所以必须向右或向左滚动。
更新:按照下面的建议添加,我现在可以换行,但有些行如下所示:
The state owned oil company that
provides one third of the revenue of
the
Mexican government is in a deep crisis,
owing to low oil prices,
inefficiency, and corruption. The
implications for the United States are
important. More
The Calamitous Climate at
etc etc
这是我的 html:
String htmlstuff = " \n" +
"<html>\n" +
"<header><title>This is title</title></header>\n" +
"<body>\n" +
"<pre style=\"white-space: pre-wrap;\">\n";
htmlstuff=htmlstuff+result;
htmlstuff=htmlstuff+
" </pre>\n"+
"</body>\n" +
"</html>\n";
wv.loadDataWithBaseURL("", htmlstuff, "text/html", "UTF-8", "");
wv.setHorizontalScrollBarEnabled(false);
最佳答案
考虑这个 Html display formatted text
你只需要将你的文字放在
<pre>
标记并使用 CSS
white-space: pre-wrap;
属性显示它没有像这样的水平滚动
<pre style="white-space: pre-wrap;">
Formated text
Line 2 with wide spaces
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</pre>
关于android - 需要在 HTML webview 中显示文本格式的数据,如 Stack Overflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35723872/
在编写代码时,当我编写 struct *Stack stack 时,代码无法工作,而当我像 struct Stack* stack 那样编写代码时,代码可以工作有人告诉我这两个代码之间的区别吗? 最佳
我的教授要我绘制堆栈吗?他想让我付诸行动吗?我觉得自己很愚蠢,但这不像任何人告诉我的那样!感谢您的帮助。 哇,你们真快。已经谢谢你了。完整的问题是:考虑两个堆栈,每个堆栈的大小为 n(即,每个堆栈最多
是new Stack[N]相当于new Stack[N]对于通用数据类型 Stack ? 编辑:虽然我知道最好避免混合泛型类型和数组,并且存在更强大的解决方案,但我的查询仍然存在:被广泛认可的教科书,
我正在尝试使用堆栈的 printf() 打印 stack.top() 的返回值,但它给出的格式不匹配。代码如下: int main(){ stack cards; char *ch1
我正在尝试做一个 dapp 项目。 我有一个堆栈太深的错误,但我不知道如何解决这个问题。 CompilerError: Stack too deep, try removing local varia
在哪里stack haddock (或 stack build --haddock )放置它生成的文档? 最佳答案 这取决于为“属于”生成黑线鳕的包的位置。 “本地”包的 Haddocks 是堆栈项目
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
基本上,我有 2 个文件(.adb 和 .ads)。我对 Ada 以及如何编译 2 个文件完全陌生。该程序是一个基本的堆栈实现。编译 .adb 文件时出现此编译错误。 $ gcc -c test_ad
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 5年前关闭。 Improve this questi
您好,我正在尝试在微服务架构中使用 ELK 堆栈,其中有许多服务分布在许多服务器上。 现在我已经配置了 Kibana 和 ElasticSearch。现在我的疑问是我必须在哪里安装 Logstash。
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
我正在学习 Haskell,但遇到了我没想到的异常“堆栈溢出”。 代码相当简单: type Reals = Double prod :: Reals -> Reals -> Reals prod a
在我的 PC(最新的 JDK 和编译器版本)上,我的程序运行得非常顺利。但在我教授的计算机上,她说她遇到了两个错误 1) Stack myStack= new Stack() 类型的非法开始 2) 非
当我尝试在调用跟踪后执行 ./stack.sh 时,我收到以下错误: `[Call Trace] ./stack.sh:217:source /home/work/devstack/stackrc
1 上下文 我参与了一个涉及大量 C 位和 FFI 的 Haskell 项目。所以我发现自己经常运行和重新运行命令,比如 $ stack build $ stack build --force-dir
关于 SO 上的堆栈的问题,终于!我的一生都让我走到了这一步。 所以我需要将我制作的一些相当大的自定义数据结构合并到一个堆栈中。我决定编写一个仅包含一个整数值的最小堆栈结构。这里是 - MODULE
我只是想知道为什么在括号之间嵌入表达式时会得到两个不同的成员列表,例如gl-stack。看起来,如果没有括号,表达式就会被完全求值,并且结果会立即传递到下一个管道组件。但通过括号,集合中的单个对象将被
是否可以保存Stack>在onSaveInstanceState . 是否可以通过另一种方式保存某些特定数据来管理 Activity 状态? 最佳答案 您无法将 View 保存到 bundle 中。无
这个问题已经有答案了: Why don't Java Generics support primitive types? (5 个回答) 已关闭 9 年前。 为什么我不能使用Stack ? 除了拳击之
基于数组的实现级别 #include "stack.h" void creat_stack(Stack *s) { s->Top = 0; } int isFull(Stack s) {
我是一名优秀的程序员,十分优秀!