How can I delete the line below my Tab layout? - android

I'm sory for my poor Englisch. I come from Holland, and I'm just 14.
I am practicing my android development skills, but I have a problem. If I create a tab menu comes a horizontal line below. With a black background you don't see it, but if it is white you'l see it.
![http://img703.imageshack.us/img703/503/emulator.png][1]
My question is rather simple. How can I delete that line? The XML layoutfile of this tab menu is displayed 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"
android:background="#ffffff">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>

please try by removing android:padding="5dp" from the FrameLayout.

have you tried xml attributes in here?

Related

Android Actionbar Tabs on bottom of screen

I agree before-hand with anyone who wants to make the argument that tabs should be at the top of the screen, but I can't control the requirements for my app :) . I have to build an app with tabs at the bottom of the screen. I'm using SDK 14 and Actionbars. Is this even possible? I have already built a layout with the tabs at the bottom, but when I add the tabs to the ActionBar, they are automatically rendered at the top of the screen.
Any ideas would be really appreciated, and thank you all for taking the time to read this post.
You can use Tabhost for requirement,and inside tab.xml you can write below code . This will work fine .
<?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">
<RelativeLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<FrameLayout android:id="#android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1" >
</FrameLayout>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:tabStripEnabled="false"
android:layout_alignBottom="#android:id/tabcontent"
android:background="#000000" />
</RelativeLayout>
</TabHost>

android:tabStripEnabled="false" doesn't work

I was using tabhost and trying to disable the tab border line. I used this android:tabStripEnabled="false"
in my XML but it doesn't seem to be working, the line was still there, and I try other way like making changes in the style.xml(which I found from stackoverflow) but it doesn't work either. Any idea?
my tab xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<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" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#android:id/tabs" />
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#FFFFFF"
android:tabStripEnabled="false"
android:layout_gravity="bottom" />
</RelativeLayout>
</TabHost>
</LinearLayout>
You can remove the bottom strip of tabs and divider between tabs by using following statement.
TabHost t;
t.getTabWidget().setStripEnabled(false);
t.getTabWidget().setDividerDrawable(R.drawable.ic_launcher);
It requires minSDK 8 (2.2) at least... Review your manifest.
Be sure that there insn't a line, in your code, setting tab's background (I had this problem ...) ;)

TabHost in Android

Hello Friends I implement TAbHost in my code and I want to tab below any widgets(Button, TextView, etc..)but I am not do this. Plz Help me.
Means in Xml at Top widgets and below widgets tab will be presented.
Are you wanting to put tabs at top or tabs at bottom of Layout? i couldn't understand.
If you mean at the top I suggest you do the Google Tab Layout Tutorial
I hope that helps
<?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">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_above="#android:id/tabs" />
<TabWidget android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>

top border on FrameLayout when using tabs

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

Info about Foursquare's app Layout

look at this:
http://www.eurodroid.com/pics/android_foursquare_update_1.jpg
Someone knows how is structured this layout?
Is a 3 tab layout, but the content of this tab?
Is a table, a ListAdapter, what is?
Thank you a lot.
The Foursquare app for Android is open source. I believe what you are looking for is their main_activity.xml:
<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" >
<!-- Background color should be the last value in the selected tab gradient. -->
<LinearLayout
android:id="#+id/tabBackground"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dip"
android:background="#4d4d4d">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<!-- A paddingTop of zero will remove the strip below the tabs. -->
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="5dip" />
</LinearLayout>
</TabHost>
The content of that tab specifically is just a customized ListView. As pointed out by Bryan, you can browse the source code to see the exact XML layouts they used.

Categories

Resources