Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要创建一个如下所示的 UI。
当我编写代码并运行应用程序时,它会加载第一个选项卡,即“类别”。我需要的是在不更改 Tab 顺序的情况下运行应用程序时加载第二个选项卡,即“主页”。
下面是我的代码。
不管是 PagerSlidingTabStrip 还是其他,您需要设置 viewpager 的当前项目:
setCurrentItem(int item)
设置当前选择的页面。
使用此代码将第二个选项卡设为默认选项卡。
actionBar.setSelectedNavigationItem(1);
有用。