<HorizontalScrollView 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbarAlwaysDrawHorizontalTrack="false">

<TabWidget android:id="@android:id/tabs"
android:background="#358954"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TabWidget>

</HorizontalScrollView>
显示标签的地方什么都看不到。为什么?
<HorizontalScrollView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:scrollbarAlwaysDrawHorizontalTrack="false">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="wrap_content" 
android:orientation="horizontal"
android:layout_height="fill_parent">
<Button 
android:text="1" 
android:id="@+id/Button01"
android:layout_width="200px" 
android:layout_height="wrap_content" />
<Button 
android:text="2" 
android:id="@+id/Button02"
android:layout_height="wrap_content" 
android:layout_width="200px" />
<Button 
android:text="3" 
android:id="@+id/Button03"
android:layout_width="200px" 
android:layout_height="wrap_content" />
<Button 
android:text="4" 
android:id="@+id/Button04"
android:layout_width="200px" 
android:layout_height="wrap_content" />
<Button 
android:text="5" 
android:id="@+id/Button05"
android:layout_width="200px" 
android:layout_height="wrap_content" />
<Button 
android:text="6" 
android:id="@+id/Button06"
android:layout_height="wrap_content" 
android:layout_width="200px" />
<Button 
android:text="7" 
android:id="@+id/Button07"
android:layout_width="200px" 
android:layout_height="wrap_content" />
<Button 
android:text="8" 
android:id="@+id/Button08"
android:layout_width="200px" 
android:layout_height="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
下边这个就可以。

解决方案 »

  1.   

    TabWidget其实是个LinearLayout,里面没有内容当然不会显示了
      

  2.   


    但是去掉HorizontalScrollView之后标签就可以显示了,只是数量比较多只显示一部分。
      

  3.   

    TabWidget其实是个LinearLayout,里面没有内容当然不会显示
      

  4.   


    也就是说,我用tabhost.addTab()添加的标签如何和tabwidget关联到一起?新人求教~
      

  5.   

    标签可以看到了 ,但是无法滚动。。HorizontalScrollView怎么实现标签的滚动啊??按钮放在里边就直接可以滚动了。
      

  6.   


    你把 你的东西的 width总和 超过屏幕的width就可以滚动了..代码没有任何错误.在 TabWidget  里面加点东西.让他的 width超过 320 就差不多了..
      

  7.   

    这么久了怎么被挖出来了。这个我知道了,是3.0的bug。因为在除3.0意外的其它版本都没有这个问题。