[英]Horizontal Scroll View (4 listview)
in my linear layout i have 2 listview's vertically oriented. 在我的线性布局中,我有2个listview垂直。 So i want to add to the "second slide" two more listview's which are simmilar like those before.
因此,我想在“第二张幻灯片”中添加另外两个类似于以前的列表视图。 When I open my app, first 2 listview which are vertically oriented will be shown, and then when I scroll to right another 2 listview will be shown.
当我打开我的应用程序时,将显示前两个垂直方向的列表视图,然后当我向右滚动时,将显示另外2个列表视图。
And I tried do this with horizontal scroll, i had 2 linear layout in horizontal scroll view brackets. 我尝试用水平滚动做到这一点,我在水平滚动视图括号中有2个线性布局。 In first linear layout were first 2 listview's and in second linear layout were another two ...
在第一个线性布局中是前两个listview,在第二个线性布局中是另外两个...
And I got this in console: HorizontalScrollView can host only one direct child... 我在控制台中得到了这个:HorizontalScrollView只能托管一个直接子代...
So, if I'm right, i can't have two linear layouts in HorizontalScrollView. 所以,如果我是对的,我在HorizontalScrollView中不能有两个线性布局。 Does anyone have another idea how to do it?
有谁知道该怎么做? I'm new in android, so i don't have any idea how to do it...
我是android的新手,所以我不知道该怎么做...
Thank you, Matija :) 谢谢你,Matija :)
So, if I'm right, i can't have two linear layouts in HorizontalScrollView
所以,如果我是对的,我在HorizontalScrollView中不能有两个线性布局
That's correct, at least not two that are direct children of the ScrollView
as the error message tells you. 是正确的,因为错误消息告诉您,至少没有两个是
ScrollView
直接子级。
You could, however, wrap those two LinearLayout
s in a LinearLayout
(sounds like with horizontal orientation though I'm having trouble picturing what you are doing). 但是,您可以将这两个
LinearLayout
包裹在LinearLayout
(声音听起来像水平方向,尽管我无法想象自己在做什么)。
If you could explain a little better what you are trying to accomplish (maybe with an image) then we may be able to give you a better suggestion. 如果您可以更好地解释您要完成的工作(也许带有图像),那么我们可能会为您提供更好的建议。 Sounds like fragments and/or
ViewPager
might work better for you. 听起来像片段和/或
ViewPager
可能更适合您。 Either way, this should solve your problem. 无论哪种方式,这都可以解决您的问题。
Pictorially: 图示:
You can't have this 你不能有这个
ScrollView
/ \
LinearLayout LinearLayout
You can have this 你可以有这个
ScrollView
|
LinearLayout
/ \
LinearLayout LinearLayout
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.