如何使用ActionSherlock实现ActionBar视图等Google地图?

时间:2013-06-15 11:13:11

标签: android android-layout tabs android-actionbar spinner

我需要实现的目标:

  • 自定义微调器,例如this layout
  • 激活此微调器中的选项可以将用户引导至滑动选项卡视图,如this layout(OFFLINE - STARRED - 最近选项卡)

我设法实现的目标:

  • Custom spinner喜欢Google地图。但我无法使用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);
    
  • Swipe tabs但它看起来不像我需要的:微调器位于标签下方。

        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") );
    

我如何实现Google地图等布局?

0 个答案:

没有答案