2

我需要达到的目标:

我设法实现的目标:

  • 自定义微调器,如谷歌地图。但我无法使用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") );
    

我将如何实现像谷歌地图这样的布局?

4

0 回答 0