简体   繁体   English

ViewPager-隐藏页数

[英]ViewPager - Hide number of pages

I'm building my Android App using Viewpagers, and I built a ListView that takes 8 seconds to show the full Items. 我正在使用Viewpagers构建我的Android应用,并构建了一个需要8秒才能显示完整项目的ListView。

The page doesn't update the view automatically, thats why the Listview appears empty when it is shown for the first time. 该页面不会自动更新视图,这就是为什么Listview首次显示时显示为空的原因。

So, I was thinking about creating a new page called loading, and hide the page with the listview, and only show it when the Listview items are already there. 因此,我正在考虑创建一个名为loading的新页面,并使用listview隐藏该页面,仅在Listview项目已经存在时才显示它。

To do that, I would like to know how can I hide pages. 为此,我想知道如何隐藏页面。

I tried to use an Handler and change the number of pages after 8 seconds, but it didn't work, can you guys give me any idea of how can I do that? 我尝试使用Handler并在8秒后更改了页面数,但是它没有用,你们能告诉我我该怎么做吗?

Thanks. 谢谢。

You shouldn't create a new page called loading,it is not a good way to solve it. 您不应该创建一个名为loading的新页面,这不是解决它的好方法。 You can u get data in oncreat first time,then update data by a timer or handler + timertask and so on. 您ü可以在oncreat第一次获取数据,然后更新由数据timerhandler + timertask等等。

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

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