横向滚动视图和形象的看法?视图、横向、看法、形象

2023-09-06 18:14:37 作者:人美是非多。

我想一些图像视图添加到 Horizo​​ntalScrollView 动态。我有我的滚动视图:

I want to add a number of image views to a HorizontalScrollView dynamically. I have my scroll view:

myScroller = new HorizontalScrollView(this);

然后:

myScroller.addView(myImageView1);

这工作,但我想多个图像视图添加到滚动条,那么它不工作。

This works, but I want to add more than one image view to the scroller, then it doesnt work.

任何想法?

推荐答案

Horizo​​ntalScrollView只能有1个小孩,所以你需要把所有的图像水平的LinearLayout内,将其添加到Horizo​​ntalScrollView。

HorizontalScrollView can only have 1 child, so you need to put all the images inside a horizontal linearLayout and add it to the HorizontalScrollView.

心连心。