views:

572

answers:

2

I simply use the tabwidget :

mTabHost = getTabHost();

    mTabHost.addTab(mTabHost.newTabSpec("tab_1").setIndicator(getString(R.string.day0)).setContent(R.id.tab1_content));
    mTabHost.addTab(mTabHost.newTabSpec("tab_2").setIndicator(getString(R.string.day1)).setContent(R.id.tab2_content));
    mTabHost.addTab(mTabHost.newTabSpec("tab_3").setIndicator(getString(R.string.day2)).setContent(R.id.tab3_content));
    mTabHost.addTab(mTabHost.newTabSpec("tab_4").setIndicator(getString(R.string.day3)).setContent(R.id.tab4_content));
    mTabHost.addTab(mTabHost.newTabSpec("tab_5").setIndicator(getString(R.string.about)).setContent(R.id.tab5_content));

    mTabHost.setCurrentTab(0);

Why are my tabs so uggly in 2.0 (no more rounded corners as in 1.5/1.6) ?

ugly tabs here

=>

this was better

What should I do now to show "rounded corners" TABS to Nexus One (for exemple) users ;-) ?

Is it because of the following manifest lines :

<uses-sdk android:minSdkVersion="3" 
          android:targetSdkVersion="4" />

<supports-screens android:smallScreens="true"  
                  android:normalScreens="true"  
                  android:largeScreens="true"  
                  android:anyDensity="true" />

I have to keep android:anyDensity="true" otherwise I've got a problem with re-sizing of the menus described here

As a separate question, my users can change the Locale within my app itself, I then "redraw" the menus using onPrepareOptionsMenu (Menu menu) to refresh the strings within the menu with the new language choosen by the user. Is there an equivalent for TABS (I have local strings within the Title of the TABS) or do I have to delete all the tabs and re-create them from scratch ?

Txs in advance for your help.

Hub

A: 

u can design ur own style for tabwidget in android

use tag in xml and set hte style for ur tabwidget like:

tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.sample_shape);

for more about the tags.look at this reflink text

ApiDemos example:

Praveen Chandrasekaran
and the platform does not provide the default drawable that was used in 1.5 for the Tabs ? the one where the tabs had rounded corners ?
Hubert
A: 

but if you meddle with background resources, won't you loose the image selector capability of the tabs? I mean - you won't have different color when you select the tab, when you hover it, etc.

unless, I'm wrong, no?

oriharel