【发布时间】:2018-09-18 10:01:58
【问题描述】:
一个多星期以来,我一直在寻找这个问题的答案,但没有运气,所以我在这里提出这个问题:)
我正在创建一个句子,用户需要选择一些选项来完成它。 句子需要看起来自然,不能被换行打断。
使用的组件有:
TextView - Button - TextView - Button - TextView - Button
想要的结果是:
“How far can I go with”
'20 liters' "if I filled
in" 'diesel fuel' "if
the economy is" '10 ltr/100 km'
但是一旦选择了所有选项,屏幕变成:
“How far can I go with”
'20 liters' "if I filled in"
'diesel fuel'
"if the economy is"
'10 ltr/100 km'
我需要让它看起来自然,并尝试将按钮放在 TextViews 中。
我知道在 iOS 中有一个名为“UI Collection View”的组件来完成此行为,但我在 Android 中找不到类似的。
谢谢!
添加了几张图片来澄清。
编辑:
我们的想法是……
xxxxxxxxxxx
Button xxxx
xxxx Button
xxxxxxxxxx
Button
X 是文本
【问题讨论】:
-
使用LinearLayout 和
android:orientation="horizontal"。 -
@Dumbo 目前是这样的,但是如果文本太大,textViews会在按钮下。
-
如果屏幕显示时间过长,将
TextView移到下方。但是,如果它太长,你认为它应该是什么样子?我想你可以尝试制作更小的文本字体 -
@Dumbo 我正在使用不同的语言字符串,用英语可以很好,但在西班牙语或意大利语等其他语言中需要更多。减小文本大小不是一种选择:(
-
然后你可以使用可滚动(水平)的TextView或Activity Layout
标签: android xml android-layout