<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>
下边这个就可以。
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>
下边这个就可以。
但是去掉HorizontalScrollView之后标签就可以显示了,只是数量比较多只显示一部分。
也就是说,我用tabhost.addTab()添加的标签如何和tabwidget关联到一起?新人求教~
你把 你的东西的 width总和 超过屏幕的width就可以滚动了..代码没有任何错误.在 TabWidget 里面加点东西.让他的 width超过 320 就差不多了..