简体   繁体   English

如何使viewPager的选项卡充当微调器?

[英]How to make the tabs of viewPager to act as spinner?

I have a view pager in my app .I need the tab instead of being only text and image to be a spinner. 我的应用程序中有一个视图寻呼机。我需要选项卡,而不仅仅是将文本和图像用作微调框。 I didn't find any tutorial about that and I need to know how can I implement that 我没有找到任何有关此的教程,我需要知道如何实现

You must create a tablayout and set custom layout(contain spinner view) for each tab item like this: 您必须创建一个tablayout并为每个选项卡项设置自定义布局(包含微调器视图),如下所示:

tabLayout.getTabAt(0).setCustomView(R.layout.aquablue); tabLayout.getTabAt(0).setCustomView(R.layout.aquablue); tabLayout.getTabAt(1).setCustomView(R.layout.orangeprocess); tabLayout.getTabAt(1).setCustomView(R.layout.orangeprocess); tabLayout.getTabAt(2).setCustomView(R.layout.shipping); tabLayout.getTabAt(2).setCustomView(R.layout.shipping); tabLayout.getTabAt(3).setCustomView(R.layout.deliver); tabLayout.getTabAt(3).setCustomView(R.layout.deliver); tabLayout.getTabAt(4).setCustomView(R.layout.completedtxt); tabLayout.getTabAt(4).setCustomView(R.layout.completedtxt); tabLayout.getTabAt(5).setCustomView(R.layout.cancelled); tabLayout.getTabAt(5).setCustomView(R.layout.cancelled);

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

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