Reputation: 31
I have a screen that uses tabs in my android application. There is a line (like a border) that shows between the tabwidget and the framelayout. I want to get rid of that line, but cant seem to find what it is. I have determined that it is part of the FrameLayout by setting its visibilty to gone. Please refer to the code below:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fb8c10"
>
<ImageView
android:id="@+id/img_confirm_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/confirm_header"
/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dip"
android:background="#fb8c10"
android:tabStripEnabled="false"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/tab_bg"
/>
</LinearLayout>
</TabHost>
This is a link of the current layout and what I'm trying to do http://img441.imageshack.us/g/screenshot20110116at513.png/
The orange layout is my app, and the gray is what I'm trying to do.
Notice how in the gray screenshot the tab flows into the frame.
Apologies for the links, I can't post images yet :p
Thanks!
Upvotes: 2
Views: 3954
Reputation: 11
Just now I came across this issue. However, I also tried to remove the top border of FrameLayout. I did it. but I don't think it is a way to remove the top border. anyway FYI,
Just place an TextView with background white on Border and use AbsoluteLayout.
Eg:
<AbsoluteLayout>
<TabHost
android:layout_x="0dip"
android:layout_y="5dip" ...>
<AbsoluteLayout android:padding="5dip" android:background="#ffffff">
<TabWidget/>
<FrameLayout ....
android:layout_x="0dip" android:layout_y="65dip" />
</AbsoluteLayout>
</TabHost>
<TextView
android:layout_width="fill_parent" android:layout_height="25dip"
android:layout_x="0dip" android:layout_y="65dip"
android:background="#ffffff"/>
</AbsoluteLayout>
Upvotes: 1
Reputation: 31
I managed to solve this by manipulating the z-index using relative layout. I was able to position the tabs slightly over the frame layout. Refer to code below:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fb8c10"
>
<ImageView
android:id="@+id/img_confirm_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/tab_header"
/>
<RelativeLayout
android:id="@+id/widget77"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
android:layout_marginTop="33dip"
/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fb8c10"
android:tabStripEnabled="true"
android:layout_above="@android:id/tabcontent"
android:layout_marginBottom="40dip"
/>
</RelativeLayout>
</LinearLayout>
</TabHost>
Upvotes: 1