如何移除ViewPager指示器?



我使用actionbarsherlock。我不想显示指标像facebook。我想在customactionbar.xml上只使用图标,但我不删除指示符。

我mainpage.xml;

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:orientation="vertical">
        <fragment
            class="com.google.android.gms.maps.SupportMapFragment"
            xmlns:map="http://schemas.android.com/apk/res-auto"
            android:id="@+id/mapFragment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:name="com.google.android.gms.maps.MapFragment" />
        <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:background="#FFFFFFFF"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_margin="5dp"
                android:visibility="gone"/>
    </RelativeLayout>

and My class;

        getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
        View absview = getLayoutInflater().inflate(R.layout.customactionbar, null);
        getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        getSupportActionBar().setDisplayShowHomeEnabled(false);
        getSupportActionBar().setCustomView(absview);
        TabControlListener myTabListener = new TabControlListener(this, _viewPager);
        myTabListener.addTabChangedListener(this);
        ActionBar.Tab tab_vehicledetail = getSupportActionBar().newTab();
        myTabListener.addTab(tab_vehicledetail,FragmentDeviceDetail.class,null);
        tab_vehicledetail.setTabListener(myTabListener);
        ActionBar.Tab tab_Notify = getSupportActionBar().newTab();
        myTabListener.addTab(tab_Notify,FragmentDeviceDetail.class,null);
        tab_Notify.setTabListener(myTabListener);
        ActionBar.Tab tab_LastPosition = getSupportActionBar().newTab();
        myTabListener.addTab(tab_LastPosition,FragmentDeviceDetail.class,null);
        tab_LastPosition.setTabListener(myTabListener);

a Now http://img27.imageshack.us/img27/9012/screenshot7886652570341.png

您必须编写一个PagerTabStrip类,但是您可以使用PagerTitleStrip来代替PagerTabStrip,这会大大减少工作量。

如果你仍然想使用pagerTabStrip,你可以改变标签指示器的颜色。将其更改为您的tabstrip背景色

最新更新