我试图复制谷歌书报摊应用导航系统,在那里我可以在同一时间使用导航菜单的抽屉和标签,如: 导航抽屉和标签就像在书报摊
我m试图达到与newstand完全相同的效果,单一颜色的操作栏和制表符,以及不跨越整个屏幕长度的制表符 我能够反编译应用程序,并且我看到了另一个应用程序的来源使用这个(系列指南),但它们非常复杂,我无法找到并找出它在哪里以及如何实现。
我已经使用过Android Studio为我创造了导航抽屉中的模板,并没有影响添加标签
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
ActionBar actionBar = getSupportActionBar();
/*
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(true);
ActionBar.Tab tab = actionBar.newTab()
.setText("Artist")
.setTabListener(new TabListener<PlaceholderFragment>(
this, "artist", PlaceholderFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText("album")
.setTabListener(new TabListener<PlaceholderFragment>(
this, "album", PlaceholderFragment.class));
actionBar.addTab(tab);
*/
actionBar.setHomeButtonEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
String[] tabs = { "Top Rated", "Games", "Movies" };
// Adding Tabs
for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(new TabListener<PlaceholderFragment>(
this, "album", PlaceholderFragment.class)));
}
}
到目前为止,我已经使用了Android库尝试这样尝试过,但我不使用外部Onex公司就像福尔摩斯的ActionBar
非常感谢你的快速反应,原谅无知,但我怎么可以使用SlidingTabLayout在我的应用程序? 通常我已经处理了jar文件,我将它们放在lib文件夹中,就是这样。 我正在使用Android Studio – DoubleP90
@ DoubleP90我做了更详细的编辑。没有'jar'可以使用,你可以将这些类复制到你的项目中。 – adneal
@adneal看起来像SeriesGuide现在使用SlidingTabLayout。感谢您的链接。 – yshrsmz