简体   繁体   English

如何使用ViewPager显示应用程序?

[英]How can I use ViewPager to display apps?

As the title states, how exactly can I use ViewPager to display a list of apps. 如标题所述,我如何才能使用ViewPager显示应用程序列表。 Right now I'm using a GridView to display the list of apps on my device and it runs the app upon selection. 现在,我正在使用GridView来显示设备上的应用程序列表,并在选择后运行该应用程序。 However I wish to get a similar effect from launchers in the Play Store, the app drawer is split into different views and displays a set number of apps on one page. 但是,我希望从Play商店中的启动器中获得类似的效果,将应用程序抽屉拆分为不同的视图,并在一页上显示一定数量的应用程序。 And when you swipe it goes to the second page and displays more apps. 当您滑动时,它会转到第二页并显示更多应用程序。

How can I do this? 我怎样才能做到这一点? At the moment I just have a simple GridView which can be scrolled up and down, 目前,我只有一个简单的GridView ,可以上下滚动,

I have looked all around the internet and i have gotten no answers, I've taken a look at the aosp launchers src on github but it's too complicated to understand. 我看了看互联网的所有内容,但没有得到任何答案,我看了一下github上的aosp启动器src,但它太复杂了,难以理解。 Thank to whoever answers my question. 感谢所有回答我问题的人。

You can use Jake Wharton's Android-ViewPagerIndicator in ViewPager to display your content. 您可以在ViewPager中使用Jake Wharton的Android- ViewPagerIndicator来显示您的内容。 You can also try astutez's PagerSlidingTabStrip , it will me more suitable for your requirements. 您也可以尝试astutez的PagerSlidingTabStrip ,它会更适合您的要求。 Implementation is very simple, you can also find the sample in the repository. 实现非常简单,您还可以在存储库中找到示例

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

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