小编pra*_*eek的帖子

删除选项卡按钮周围的灰色边框(使用FragmentTabHost)

我正在使用FragmentTabHost来获取我的标签,但每个标签按钮周围都会出现灰色边框.请指导我摆脱这个灰色边框.见下面的附件: 在此输入图像描述

我希望它看起来像: 在此输入图像描述

我的布局是:

<?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>
Run Code Online (Sandbox Code Playgroud)

我的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);
Run Code Online (Sandbox Code Playgroud)

提前致谢.

android fragment-tab-host

2
推荐指数
1
解决办法
2525
查看次数

标签 统计

android ×1

fragment-tab-host ×1