我需要达到的目标:
- 像这种布局的自定义微调器
- 激活此微调器中的选项可能会将用户引导至此布局中的滑动选项卡视图(离线 - 加星标 - 最近的选项卡)
我设法实现的目标:
自定义微调器,如谷歌地图。但我无法使用
ActionBar.NAVIGATION_MODE_TABS
ActionBar bar = this.getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); MyCustomAdapter a2 = new MyCustomAdapter(this, R.layout.mainmenu_dropdownfull, string, Constants.dropdown_title, Constants.dropdown_icon, Constants.dropdown_description); MyOnNavigationListener mNavigationCallback = new MyOnNavigationListener(); bar.setListNavigationCallbacks(a2, mNavigationCallback);
滑动标签,但它看起来不像我需要的:微调器位于标签下方。
ActionBar bar = this.getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); bar.setDisplayShowCustomEnabled(true); bar.setCustomView(R.layout.bar_customview); mViewPager = new ViewPager(getApplicationContext()); adapter = new TabsAdapter(this, mViewPager ); //this is my custom class, extended from FragmentPagerAdapter mViewPager.setAdapter( adapter ); mViewPager.setOnPageChangeListener( adapter ); mViewPager.setId( 0x7F04FFF2 ); adapter.addTab( "Tab 1", BusRouteInfoFragment.class, TestFragment.createBundle( "Fragment 1 bus") ); adapter.addTab( "Tab 2", TestFragment.class, TestFragment.createBundle( "Fragment 2") ); adapter.addTab( "Tab 3", TestFragment.class, TestFragment.createBundle( "Fragment 3") );
我将如何实现像谷歌地图这样的布局?