简体   繁体   English

Android:在操作栏下方添加标签

[英]Android : Adding tabs below the action bar

In my Android application I have implemented a tab layout with swipeable views by following this tutorial. 在我的Android应用程序中,通过遵循教程,我实现了带有可滑动查看的选项卡布局。 It works fine. 工作正常。 But I want to add these tabs below the action bar. 但我想将这些标签添加到操作栏下方。

Can anyone please be so kind enough to explain how I can do this? 任何人都可以这么仁慈地解释我该怎么做吗?

http://www.javacodegeeks.com/2013/06/android-action-bar-with-tab.html http://www.javacodegeeks.com/2013/06/android-action-bar-with-tab.html

Try this ^_^ maybe this tut helps you a lot :D 试试这个^ _ ^也许这个tut可以帮助你很多:D

At the top of the link you post there is a download button. 您发布的链接顶部有一个下载按钮。 I advise to download the full project and inspect/run the code. 我建议下载完整的项目并检查/运行代码。

To add the titles below the action bar the key section of the code is to have the following in your FragmentActivity 要在操作栏下方添加标题,代码的关键部分是在FragmentActivity以下内容

// Initilization
    viewPager = (ViewPager) findViewById(R.id.pager);
    actionBar = getActionBar();
    mAdapter = new TabsPagerAdapter(getSupportFragmentManager());

    viewPager.setAdapter(mAdapter);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

try this : Tabs Below ActionBar 试试这个: ActionBar下面的标签

Above is the officical android developers link that will explain you to add the tabs below the ActionBar from scratch 上面是官方的android开发人员链接,该链接将说明您从头开始在ActionBar下方添加选项卡

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

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