Layout issues with TabHost / TabWidget

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Layout issues with TabHost / TabWidget

Postby bAZtARd » Tue May 13, 2008 3:47 pm

hi peeps. i got some problems with the Tab-stuff. i got the following layout xml file:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    android:orientation="vertical"
  6.  
  7.    android:layout_width="fill_parent"
  8.  
  9.    android:layout_height="fill_parent">
  10.  
  11.  
  12.  
  13.     <TabHost
  14.  
  15.    android:id="@+id/tabs"
  16.  
  17.    android:layout_width="fill_parent"
  18.  
  19.    android:layout_height="fill_parent">
  20.  
  21.  
  22.  
  23.     <TabWidget
  24.  
  25.    android:id="@android:id/tabs"
  26.  
  27.    android:layout_width="fill_parent"
  28.  
  29.    android:layout_height="wrap_content"/>
  30.  
  31.  
  32.  
  33.     <FrameLayout
  34.  
  35.    android:id="@android:id/tabcontent"
  36.  
  37.    android:layout_width="fill_parent"
  38.  
  39.    android:layout_height="wrap_content">
  40.  
  41.     <LinearLayout
  42.  
  43.             android:id="@+id/content1"
  44.  
  45.             android:orientation="horizontal"
  46.  
  47.             android:layout_width="wrap_content"
  48.  
  49.             android:layout_height="fill_parent">
  50.  
  51.             <TextView
  52.  
  53.                 android:layout_width="wrap_content"
  54.  
  55.                 android:layout_height="fill_parent"
  56.  
  57.                 android:text="Hello fuckin Tabs"/>
  58.  
  59.            </LinearLayout>
  60.  
  61.         </FrameLayout>
  62.  
  63.     </TabHost>
  64.  
  65.     </LinearLayout>
  66.  
  67.    
Parsed in 0.004 seconds, using GeSHi 1.0.8.4

Problem is, the TextView, which insults the Tabs ( ;) ) always gets displayed above the TabWidget (aka Tab Indicators) as if there would be two layers. A quick fix would be to set the padding for the FrameLayout. But I don't want to do this. I want to avoid using absolute pixel values.

i messed around with the wrap_conent and fill_parent stuff, but that didn't do the trick....
anyone got an idea? i wonder how google did it in the dialer app in the emulator. but ther's no src for this app....
plz halp! thx!
bAZtARd
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 09, 2008 11:03 am

Top

Postby dkkundudolan » Fri May 16, 2008 7:40 am

Hi bAZtARd,

if you wont keep absolute pixel values, then what is the use of tab?
Actually, if you remove that value, it will not show the tab. except tab remaining output will come.

I think this is your doubt. right?

Thanks,
Dolan.
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Postby bAZtARd » Wed May 21, 2008 9:39 am

hi dkkundudolan
what do absolute pixel values have to do with tabs in general? why should they be worthless without absolute pixel values? i don't get your argument... :?:

and what do you mean by "it will not show the tab"? as i said, if i remove the absolute pixel values (just as in the xml i posted) the content will be painted above the tab indicators. that means as if there were two layers: one for the tab content above another one for the tab indicators which are although visible.

what i want is that the tab content gets painted just below the indicators like in the picture below. but WITHOUT using an absolute padding value for the framelayout
Attachments
whatiget.jpg
this is how it looks without a padding at all. tab content (red circles) gets painted above tab indicators.
whatiget.jpg (16.21 KiB) Viewed 720 times
whatiwant.jpg
This is how it's supposed to look. (i'm using absolute pixels here)
whatiwant.jpg (15.58 KiB) Viewed 723 times
bAZtARd
Freshman
Freshman
 
Posts: 8
Joined: Wed Apr 09, 2008 11:03 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests