简体   繁体   English

如何与ListView并排创建动态ImageView

[英]How do I Create a Dynamic ImageView side by side with a ListView

This is the effect I am trying to achieve 这就是我想要达到的效果

The number of circles depends on the number of children in the ListView and I cant seem to achieve the same effect by using the background as a line and a circle ImageView for each child. 圆的数量取决于ListView中子级的数量,我似乎无法通过使用背景作为线条以及每个孩子的圆ImageView来达到相同的效果。

So I believe in your Adapter, there is a getCounts() functions that is publicly exposed. 因此,我相信您的适配器中有一个公开暴露的getCounts()函数。 You can use the getCounts() function to get the number of children in your ListView. 您可以使用getCounts()函数获取ListView中的子级数。


I think its better if you actually just place the imageView as a part of the item that will be a part of your list view. 我认为,如果您实际上将imageView放置在将成为列表视图一部分的项目中,那会更好。 This way you don't have to worry about the number of items and then making that many circles. 这样,您不必担心项目的数量,而不必担心那么多圈子。 That's highly inefficient too. 这也是非常低效的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM