Denis Palnitsky
Denis Palnitsky

Reputation: 18387

Get rid of the line under TabWidget

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?

Upvotes: 12

Views: 10088

Answers (5)

csati
csati

Reputation: 186

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...

Upvotes: 17

plugmind
plugmind

Reputation: 7986

In your layout xml:

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

 ... 

</TabWidget>

Upvotes: 8

Waza_Be
Waza_Be

Reputation: 39538

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

Upvotes: 0

CaseyB
CaseyB

Reputation: 25060

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.

Upvotes: 0

Sephy
Sephy

Reputation: 50392

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

Upvotes: 0

Related Questions