2010-07-16 69 views
0

我只是跟着上的标签创作教程从Android开发documentation 和我的标签并没有变成他们可能应该的样子。下面是它如何找我的屏幕: alt text http://bombhot.se/files/923947/messedtabs.png的Android TabHost外观并不如预期

,这里是它看起来应该像:

alt text http://developer.android.com/resources/tutorials/views/images/hello-tabwidget.png

我发现,谈论将在tabhost本地化,并尽一切索姆线程活动遵循相同的配置,但到目前为止还没有为我工作。想知道如果 有我丢失的东西,这里是我的清单文件:

<?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> 
+0

我目前正在使用Android 2.1 – Krewie 2010-07-16 15:49:14

回答

0

我以前做过这个API例子,我认为所有的情况是你换你的图像相比例子。请注意,选项卡如何将图像的负空间用作对比色,而将负空间与背景色相匹配。因此,如果您进入可绘制文件夹并通过交换图像来更改为选项卡创建的xml文件,则应该更接近该示例。

除此之外,你认为什么是不正确的?看起来你已经正确地完成了练习。

编辑:也作为提示,您可以将android:theme="@android:style/Theme.NoTitleBar"放在<application>中,而不必将其放入每个活动中。那么你的任何活动都不会有标题栏。

+0

我发现唯一不正确的东西(图片除外)是边框在选项卡上没有被舍入。 – Krewie 2010-07-16 16:29:42

+0

THX的小费极光:) – Krewie 2010-07-16 17:53:36

+0

另一个堆栈溢出问题似乎表明,圆角为1.5和2.0有更多的正视。你可以通过启动一个1.5模拟器来测试。 http://stackoverflow.com/questions/2346419/android-ugly-tabs-in-2-0-vs-1-5-why-where-are-my-rounded-corners-tabs – Aurora 2010-07-16 18:31:00

0

似乎有是两个问题。您已列出相反的图像。这意味着你有选择和未选择的图像倒退。此外,它看起来他们不是正确的大小。您需要考虑目标设备的dpi。

0

嗨由于Android 2.1的标签是更方的样子,我的溶液加入含圆角图像的选择。

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