Tabroid bottom line of android line

screenshot

Please note that there is a small tiny gray line that works under the tabs (except for the selected tab)? How to change / change this?

Will it be part of FrameLayout, tabHost or TabWidget? I just can't find a way to change or delete this little gray line.

thanks

+4
source share
4 answers

Create tabindicator.xml as follows.

Then paste the following code into your TabActivity class. ...

View indicator1 = getLayoutInflater().inflate(R.layout.tabindicator, null); im1 = (ImageView) indicator1.findViewById(R.id.icon); im1.setBackgroundDrawable(getResources().getDrawable( R.drawable.home)); View indicator2 = getLayoutInflater().inflate(R.layout.tabindicator, null); im2 = (ImageView) indicator2.findViewById(R.id.icon); im2.setBackgroundDrawable(getResources().getDrawable( R.drawable.account)); mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator( indicator1).setContent(new Intent(this, Home.class))); mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator( indicator2) .setContent(new Intent(this, Accounts.class))) 

Here you can modify tabindicator.xml to suit your requirements.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true"/> </RelativeLayout> 
+5
source

Here is a much simpler way to remove this gray line. Add this to the TabWidget in your layout:

 android:tabStripEnabled="false" 
+11
source

I had the same problem. I searched Stackoverflow and Google many times, but there were no answers. Now I have solved it. Here's how to do it:

 tabWidget.setRightStripDrawable(R.drawable.tab_strip); tabWidget.setLeftStripDrawable(R.drawable.tab_strip); 

tab_strip is a PNG image (width: 50 pixels, height: 2 pixels)

+2
source

This is tabindicator.xml.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" /> <RelativeLayout/> 
+1
source

All Articles