ViewFlipper 中的多个 ListView 无法加载
我在 viewflipper 中有 2 个活动,其中一个活动是列表活动,另一个是列表活动。我使用 setListAdapter 加载了列表活动,一切正常。
我在主布局的视图翻转器内添加了第三个活动。这第三个活动包含一个列表视图,就像我的第二个活动一样。我将 ListActivities 切换为活动并使用 setAdapter 加载列表视图。
当我运行应用程序并滑动到视图翻转器中的其他活动时,该列表为空。如果我将列表视图放在主 xml 中,列表视图就会填充得很好。
看起来列表在初始加载后正在重置。
I had 2 activities in a viewflipper with one activity and the other a listactivity. I loaded the list activity with setListAdapter and everything worked great.
I added a third activity inside a viewflipper in my main layout. This third activity contains a listview just like my second activity. I switched the ListActivities to activities and load the listviews using setAdapter.
The list are empty when I run the application and swipe to the other activity in the viewflipper. If I place the listview in the main xml the listview populates just fine.
It appears the list is getting reset after the initial load.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我一点击帖子就明白了!
我必须从布局文件中删除 xml。
由于我从 ListActivity 更改为 Activity,因此它覆盖了列表视图并会显示。
I figured it out as soon as i hit post!
I had to remove the xml from the layout file.
Since I changed to an Activity from a ListActivity this was overriding the listview and would display.