views:

419

answers:

5

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?

A: 

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

Sephy
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.
Orsol
You're speaking about the black line just below the tabs?
Sephy
Yes. Even if I put something between FrameLayout and TabWidget this line will be on the FrameLayout.
Orsol
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
A: 

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
A: 

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

Profete162
This do not solve the problem. This is my result http://yfrog.com/n8devicewp
Orsol
You have just to edit the PNG files. That seem not complicated...
Profete162
A: 

In your layout xml:

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

 ... 

</TabWidget>
radek-k
Didn't work. Actually shadow on FrameLayout and not on TabWidget.
Orsol
android:tabStripEnabled is available only available from 2.2
Eby
+1  A: 

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

Define a theme in themes.xml:

<style name="YourTheme">
  ...   
  <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...

csati