如何从FragmentTabhost中删除选定的选项卡指示器?

时间:2016-09-27 06:20:39

标签: android android-tabhost fragment-tab-host

我已尝试使用多个链接删除FragmentTabHost中的所选标签,但对我不起作用 First link
Second link

我也在我的Xml中尝试了这个,但它无法正常工作

android:tabStripEnabled="false"

这是我对fragmenttabhost的布局。

<FrameLayout

    android:id="@+id/realtabcontent"
    android:layout_width="match_parent"
    android:layout_weight="1"
    android:layout_height="0dp"
     />
    <android.support.v4.app.FragmentTabHost
      android:id="@android:id/tabhost"
      android:layout_width="match_parent"
      android:layout_alignParentBottom="true"
      android:background="@drawable/top_bg"
      app:tabIndicatorColor="#000"
      android:tabStripEnabled="false"
      app:tabIndicatorHeight="0dp"
      android:layout_height="60dp"
      >

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0" />

    <LinearLayout
        android:id="@+id/tab_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:showDividers="none"
        android:orientation="horizontal"
        android:weightSum="5" >

        <ImageView
            android:id="@+id/genralTabBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:padding="15dp"
            android:background="@drawable/button_1_off" />

        <ImageView
            android:id="@+id/treandingTabBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:padding="12dp"
            android:background="@drawable/button_2_off" />

        <ImageView
            android:id="@+id/profileTabBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:padding="12dp"
            android:background="@drawable/button_3_off" />

</android.support.v4.app.FragmentTabHost>

在我的设备中,所选标签看起来像(Plz检查图像)

Moto E设备

Moto E device

HTC设备 HTC device

1 个答案:

答案 0 :(得分:3)

对不起,迟到的回复 我也遇到了这个问题,我尝试了很多东西,最后我获得了成功。

  

尝试以下代码。

gulp.src
  

fragmentTabHost.getTabWidget()。getChildAt(&#34;你的标签位置&#34;)。setBackground(null);

只需要让孩子接触并将其背景设为null并完成

相关问题