gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 16:40:49 28 4
gpt4 key购买 nike

我正在使用 FragmentTabHost 获取我的选项卡,但每个选项卡按钮周围都有一个灰色边框。请指导我摆脱这个灰色边框。见下面的附件: enter image description here

我希望它看起来像: 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);

提前致谢。

最佳答案

自己完成了工作,并且按要求工作。谢谢。

只使用下面的代码:

    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);

关于android - 移除选项卡按钮周围的灰色边框(使用 FragmentTabHost),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18081507/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com