Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个纯文本,我想“标记”它的单词。是否存在执行此类 UI 的组件?例如,我想使用“Lorem ipsum dolor sit amet consectetur adipiscing elit”之类的文本并创建如下视图:
我进行了一些搜索,但未能找到一个简短/简单的实现。有人有建议吗?
提前致谢!
回答我自己的问题:我通过创建一个 ViewGroup 并使用自定义按钮填充它来做到这一点。目前,这听起来是最好和最简单的方法。初步的伪代码是:
View view = findViewById(someId); foreach (word in theText) { Button bt = new button(word); // a new button, with "word" as label view.addView(bt); }