Get rid of the line under TabWidget
Asked Answered
S

5

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?

Showbread answered 18/8, 2010 at 11:36 Comment(0)
O
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...

Odd answered 9/9, 2010 at 17:12 Comment(3)
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?Quinton
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: developer.android.com/guide/topics/ui/…Momentum
@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?Novelia
C
8

In your layout xml:

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

 ... 

</TabWidget>
Clypeate answered 27/8, 2010 at 9:29 Comment(2)
Didn't work. Actually shadow on FrameLayout and not on TabWidget.Showbread
android:tabStripEnabled is available only available from 2.2Sami
O
0

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

Oversold answered 18/8, 2010 at 12:40 Comment(4)
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.Showbread
You're speaking about the black line just below the tabs?Oversold
Yes. Even if I put something between FrameLayout and TabWidget this line will be on the FrameLayout.Showbread
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 lookOversold
O
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.

Originality answered 23/8, 2010 at 18:26 Comment(0)
S
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

Standardize answered 25/8, 2010 at 0:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.