How do I remove the selected tab indicator from the TabWidget?
If android:tabStripEnabled="false"
did not work then I also assume calling setStripEnabled(boolean stripEnabled)
will have no effect as well. If all of this is true then your problem is probably not in TabWidget.
I would suggest looking at your tab indicator. Try these modifications. This code is taken from a fragment that has tabs.
Here is the code that creates the tab indicator view.
View indicator = LayoutInflater.from(getActivity()).inflate(R.layout.tab,
(ViewGroup) mRoot.findViewById(android.R.id.tabs), false);
TabSpec tabSpec = mTabHost.newTabSpec(tag);
tabSpec.setIndicator(indicator);
tabSpec.setContent(tabContentId);
Your tab indicator view would probably like similar to this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@drawable/tabselector"
android:padding="5dp" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tab1icon"/>
</LinearLayout>
Now the important part here is the android:background="@drawable/tabselector"
in the LinearLayout. Mine looks like this.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item
android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/tab_unselected_light" />
<item
android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_selected_light" />
<!-- Focused states -->
<item
android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_focused_light" />
<!-- Pressed state -->
<item
android:state_pressed="true"
android:drawable="@drawable/tab_pressed_light" />
</selector>
This tabselector.xml is where you will swap @drawable/tab_pressed_light
with your @drawable/tab_button_active
and @drawable/tab_unselected_light
with @drawable/tab_button_inactive
Be sure to check that all of your drawables that go into your tabselector.xml do not have the blue strips along the bottom. As I look at your image I can see little 5px gaps along that strip this is what gave me the idea that the strip was not from your TabWidget. Hope this helps.
This line app:tabIndicatorHeight="0dp"
solve the problem for me in xml
<android.support.design.widget.TabLayout
android:id="@+id/view_bottom_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorHeight="0dp" //this line
app:tabGravity="fill"
app:tabMode="fixed" />
I have yet another hack.
TabLayout tabLayout = (TabLayout) fragmentView.findViewById(R.id.tabs);
tabLayout.setSelectedTabIndicatorHeight(0);
It's basically the same idea as Eleojasmil's.