12

I've got simple tab activity with next layout:

    <TabWidget
    android:id="@android:id/tabs"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"                  
    android:background="#ffffff00"        />

<FrameLayout            
    android:id="@android:id/tabcontent"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"     
   android:background="#ffffff00"          />

I use buttons as indicators for tabs

tabHost.addTab(tabHost.newTabSpec("Tab1")
                .setIndicator(new Button(this))                
                .setContent(new Intent(this, TabActivity1.class)));   

tabHost.addTab(tabHost.newTabSpec("Tab2")
                .setIndicator(new Button(this))                
                .setContent(new Intent(this, TabActivity2.class)));

In this case FrameLayout always got black line and shadow effect on top (you can see it under buttons):

alt text

The question is: How can I get rid of this line? Where is the method that draws it in Android sources?

Denis Palnitsky
  • 18,267
  • 14
  • 46
  • 55

5 Answers5

17

Apply a custom theme to your activity, and null out the android:windowContentOverlay attribute.

Define a theme in themes.xml:

<style name="YourTheme" parent="if you want">
  ...   
  <item name="android:windowContentOverlay">@null</item>
  ...
</style>

Apply the theme on your application or the activity in AndroidManifest.xml:

<application android:theme="@style/YourTheme"
  ... >

Hope it helps. It caused me lots of headache...

Mohammed Elsabry
  • 503
  • 5
  • 12
csati
  • 186
  • 2
  • 2
    This also removes the window content overlay for the current activity though. Is there no way to remove only the overlay for the tab host's intents? – Michael Pardo Dec 07 '10 at 15:14
  • THANK YOU! And for all who have a theme already on the application tag like hiding the title bar for example, look here for inheriting from a parent style: http://developer.android.com/guide/topics/ui/themes.html#DefiningStyles – Anthony Graglia Apr 19 '12 at 21:36
  • @SpK : you commented on my problem yesterday. That problem looks same to this problem, but even this approach din't work for me. Any ideas? – Yogesh Somani Aug 11 '12 at 07:06
8

In your layout xml:

<TabWidget ... 
    android:tabStripEnabled="false" >

 ... 

</TabWidget>
plugmind
  • 7,926
  • 4
  • 34
  • 39
0

It seems that the way of doing that is to nest the tabwidget in a LinerLayout... Look here.

Community
  • 1
  • 1
Sephy
  • 50,022
  • 30
  • 123
  • 131
  • This is not my case. He talks about line on TabWidget, but I talk about line on RelativeLayout. Even if I put TabWidget to bottom then RelativeLayout will always have this line and shadow. – Denis Palnitsky Aug 18 '10 at 13:00
  • You're speaking about the black line just below the tabs? – Sephy Aug 18 '10 at 13:47
  • Yes. Even if I put something between FrameLayout and TabWidget this line will be on the FrameLayout. – Denis Palnitsky Aug 20 '10 at 07:56
  • 1
    I think this have somethin to do with Android styles maybe like a shadow or something they are adding, but I don't know where to look – Sephy Aug 20 '10 at 09:04
0

Unfortunately you can't get rid of it. This is a result of how the TabWidget is implemented. Internally the TabWidget is an ActivityGroup and the contents of each tab is its own Activity.

CaseyB
  • 24,780
  • 14
  • 77
  • 112
0

What I suggest you is to use the library provided by GrreenDroid: http://android.cyrilmottier.com/?p=274

Just have a look at The GDTabActivity, you will be able to tweak everything and get rid of this Bar.

http://android.cyrilmottier.com/medias/actionbar/action_bar_4.png

Waza_Be
  • 39,407
  • 49
  • 186
  • 260