我有一个 Activity,其中 Scrollview 作为顶级元素。里面还有一些其他视图,并且在某些时候还有一个 TabHost。通过查看您可能会有更好的印象截图 http://img263.imageshack.us/img263/5329/bildschirmfoto20100106u.png。 TabHost 具有三个选项卡,每个选项卡都有另一个由 Intent 启动的 Activity。
除了一件事之外,一切都工作正常。每当我单击选项卡时,滚动视图就会自动向下滚动,如您所见在这里 http://img341.imageshack.us/img341/5329/bildschirmfoto20100106u.png。之后 TabHost 就退出屏幕了。我只是不想让它向下滚动,但看不出问题是什么。我在 1.5 和 1.6 设备以及 2.0 模拟器上进行了测试,结果相同。
我的 TabHost 的 xml 如下所示:
<TabHost
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</FrameLayout>
</LinearLayout>
</TabHost>
这是添加选项卡的代码:
private void addTab(int descriptionRes, Class<?> destination, int flags) {
String description = getString(descriptionRes);
TabSpec spec = mTabHost.newTabSpec(description);
spec.setIndicator(description);
Intent i = new Intent(this, destination);
i.setData(Uri.parse(member.getId())).setFlags(flags);
spec.setContent(i);
mTabHost.addTab(spec);
}
有什么建议么?
您可以尝试设置Activity
inside the TabHost
作为可滚动的,而不是顶层Activity
itself.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)