TextView 和 EditText 的可回流混合?
我正在尝试制作一个类似于句子填充的界面,我可以在段落中任意混合 TextView
和 EditText
。
我看过这个问题,但问题是当我有 [ TextView1
, EditText
, TextView2
] 并且 TextView1
的内容占用 1 个整行和 1 个五分之一第二行,则 TextView1
将必须跨越整个宽度,因为它是一个矩形。这会将 EditText
推到下一行,这很丑陋。
那么是否可以从 Android 中的现有内容创建此类 ViewGroup/Layout,或者我必须从头开始创建自定义 View
?
如果我不擅长解释,这个屏幕截图描述了我的问题:
非常感谢。
I am trying to make a sentence-filling like interface, where I can have TextView
s and EditText
s mixed arbitrarily in a paragraph.
I have had a look at this question, but the problem was that when I have [ TextView1
, EditText
, TextView2
] and the content of TextView1
consumes 1 full line and 1 fifth of the second line, then TextView1
will have to span the entire width because it is a rectangle. This pushes EditText
to the next line, which is ugly.
So is it possible to create such kind of ViewGroup/Layout from existing stuff in Android, or I'd have to make a custom View
from scratch?
In case I'm too bad at explaining, this screenshot describes my problem:
Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这里有一些工作:)
您应该创建两个文本视图 - 一个用于第 1 行,一个用于第 2 行。估计适合第一行的文本,将其放入第一个文本视图中。把剩下的放在第二行,它会很好地适合......我想你知道这一点,并且我怀疑是否有更简单的方法来做到这一点:)
无论如何,这是一个很好的任务。
问候,
丹尼尔
I think there's some work here :)
You should make two text views - one for line 1, one for line 2. Estimate the text, that fits on the first line, put it in the first text view. Put the rest in the second line, and it'll fit just nice.... I think you know this, and I doubt there is an easier way to do this :)
It's a nice task anyway.
Greets,
Danail