2013-08-06 52 views
2

我正在使用FragmentTabHost來獲取我的選項卡,但每個選項卡按鈕周圍都會出現灰色邊框。請指導我擺脫這個灰色邊框。見下文附件: enter image description here刪除選項卡按鈕周圍的灰色邊框(使用FragmentTabHost)

我希望它看起來像: enter image description here

我的佈局是:

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <FrameLayout 
     android:id="@+id/realtabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@+id/tabhost" /> 

    <android.support.v4.app.FragmentTabHost 
     android:id="@+id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     > 

     <FrameLayout 
      android:id="@+id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      /> 
    </android.support.v4.app.FragmentTabHost> 

</RelativeLayout> 

而且我的Android的代碼是:提前

mTabHost = (FragmentTabHost)findViewById(R.id.tabhost); 
     mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); 

     mTabHost.setBackgroundColor(Color.BLACK); 


     mTabHost.addTab(mTabHost.newTabSpec(HOMETAB_TAG).setIndicator("" , getResources().getDrawable(R.drawable.home_selector)), HomeContainerFragment.class, null); 
     mTabHost.addTab(mTabHost.newTabSpec(QRTAB_TAG).setIndicator("", getResources().getDrawable(R.drawable.qr_selector)), QrContainerFragment.class, null); 
     mTabHost.addTab(mTabHost.newTabSpec(AROUNDTAB_TAG).setIndicator("", getResources().getDrawable(R.drawable.around_selector)), AroundContainerFragment.class, null); 
     mTabHost.addTab(mTabHost.newTabSpec(SHARETAB_TAG).setIndicator("", getResources().getDrawable(R.drawable.share_selector)), ShareContainerFragment.class, null); 
     mTabHost.addTab(mTabHost.newTabSpec(MORETAB_TAG).setIndicator("", getResources().getDrawable(R.drawable.more_selector)), MoreContainerFragment.class, null); 

謝謝。

回答

5

得到了我自己的工作,並按要求工作。謝謝。

只是用下面的代碼:

mTabHost.addTab(mTabHost.newTabSpec(HOMETAB_TAG).setIndicator(""), HomeContainerFragment.class, null); 
    mTabHost.addTab(mTabHost.newTabSpec(QRTAB_TAG).setIndicator(""), QrContainerFragment.class, null); 
    mTabHost.addTab(mTabHost.newTabSpec(AROUNDTAB_TAG).setIndicator(""), AroundContainerFragment.class, null); 
    mTabHost.addTab(mTabHost.newTabSpec(SHARETAB_TAG).setIndicator(""), ShareContainerFragment.class, null); 
    mTabHost.addTab(mTabHost.newTabSpec(MORETAB_TAG).setIndicator(""), MoreContainerFragment.class, null); 

    mTabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.home_selector); 
    mTabHost.getTabWidget().getChildAt(1).setBackgroundResource(R.drawable.qr_selector); 
    mTabHost.getTabWidget().getChildAt(2).setBackgroundResource(R.drawable.around_selector); 
    mTabHost.getTabWidget().getChildAt(3).setBackgroundResource(R.drawable.share_selector); 
    mTabHost.getTabWidget().getChildAt(4).setBackgroundResource(R.drawable.more_selector); 

    mTabHost.getTabWidget().setStripEnabled(false); 
    mTabHost.getTabWidget().setDividerDrawable(null); 
+0

它的工作!酷:) –