views:

51

answers:

3

Hello , i just followed the tutorial on tabs creation from the android dev documentation and my tabs didn't turn out the way they probably should. Here is a screen on how it looks for me: alt text

and here is how it should look like:

alt text

I found som threads that talks about putting localisation on the tabhost and make every activity follow the same configuration but it hasn't worked for me so far. Wondering if there's something i'm missing, here is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.koollateral.myWallet"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" 
                 android:label="@string/app_name">
        <activity android:name=".mywallet"
                  android:label="@string/app_name"
                  android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
         <activity android:name=".homeActivity" 
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar"> 
                   </activity>   
         <activity android:name=".calendarActivity" 
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar"> 
                   </activity>  
    </application>


</manifest>
A: 

I've done this API example before, and I think all that has happened is you have swapped your images compared to the example. Note how the tab uses the negative space of the image as the contrasting colour, while you matched the negative space to the background colour. So if you go into your drawable folder and change the xml file you created for the tabs by swapping the images, it should look a little closer to the example.

Other than that, what do you think isn't right? It appears that you have done the exercise correctly.

Edit: also as a tip, you can put android:theme="@android:style/Theme.NoTitleBar"in the <application> instead of having to put it into every Activity. Then none of your activities will have the title bar.

Aurora
The only thing i find incorrect (except the images) is that the borders are not rounded on the tabs.
Krewie
thx for the tip Aurora :)
Krewie
Another stack overflow question seems to indicate that the rounded corners are from 1.5, and 2.0 has the more square look. You can test this by starting a 1.5 emulator.http://stackoverflow.com/questions/2346419/android-ugly-tabs-in-2-0-vs-1-5-why-where-are-my-rounded-corners-tabs
Aurora
A: 

There seem to be two problems. You have listed the images reversed. Meaning you have the selected and unselected images backwards. Also it looks like they are not the right size. You need to consider the dpi of the device you are targeting.

CaseyB
A: 

Hi guys since Android 2.1 the tabs are more square look, my solution was adding a selector containing images with rounded corners.

tabs.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.mytab_roundedcorner);
Jorgesys