开发者

Android : ugly TABS in 2.0 vs 1.5 ... why ? where are my rounded corners TABS?

开发者 https://www.devze.com 2022-12-21 15:51 出处:网络
I simply use the tabwidget : mTabHost = getTabHost(); mTabHost.addTab(mTabHost.newTabSpec(\"tab_1\").setIndicator(getString(R.string.day0)).setContent(R.id.tab1_content));

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


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:


As you've probably discovered for yourself in the last two years, there is no answer. Fashion ebbs and flows; bell-bottom jeans are in one year, and capri pants are in a few years later. You like one, someone else likes the other. So it goes.

You are welcome to create your own custom widgets in the style that you like. While custom widgets can be a pain and can also cause problems down the road, this is how Android is made. Sorry--I don't like it either.

But if it were easy, then EVERYONE could/would do it.

0

精彩评论

暂无评论...
验证码 换一张
取 消