简体   繁体   English

如何删除ViewPager指示器

[英]How Can I remove ViewPager Indicator

I use actionbarsherlock. 我使用actionbarsherlock。 I dont want to show indicator like facebook. 我不想显示类似Facebook的指标。 I want to use only icon on customactionbar.xml but i dont remove indicator. 我只想在customactionbar.xml上使用图标,但不删除指示器。

My mainpage.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 现在http://img27.imageshack.us/img27/9012/screenshot7886652570341.png

You have to write a PagerTabStrip class, but instead of using PagerTabStrip you can use PagerTitleStrip will reduce the work greatly. 您必须编写一个PagerTabStrip类,但是可以使用PagerTitleStrip代替使用PagerTabStrip,这样可以大大减少工作量。

if you wanted to use pagerTabStrip still, you can change the color of the tab indicator. 如果您仍要使用pagerTabStrip,则可以更改选项卡指示器的颜色。 change it to your tabstrip background color. 更改为您的Tabstrip背景颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM