Here\'s what I\'d like to remove :
How do I replace the indicator show
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.
I assume you are using ActionBarSherlock. The problem with using a TabWdiget is, that it is not part of ABS, so it will look "native" for each Android Version. For me, the best approach for tab navigtion with ABS is to use a ViewPager and ViewPagerIndicator and style the indicator. Downside is, that your tabs must be fragments. If you need your tabs to be activities then you should take a look if the guys at HoloEveryhwhere have managed to add the TabWidget.
tabHost.getTabWidget().setStripEnabled(false);
tabHost.getTabWidget().getChildAt(1).setBackgroundColor(getResources().getColor(R.color.tabcolor));
tabHost.getTabWidget().getChildAt(2).setBackgroundColor(getResources().getColor(R.color.tabcolor));
More info here
Set attribute android:tabStripEnabled="false"
for your TabWidget
.
there is one line answer to that you have only to change the color of the indicator into a transparent
color.xml
<color name="transparent2">#00000000</color>
and put this line to your tabwidget
tabLayout.setSelectedTabIndicatorColor(getResources().getColor(R.color.transparent2));
or
app:tabIndicatorColor="@color/transparent2"