最上位要素として Scrollview を持つアクティビティがあります。内部にはいくつかの他のビューがあり、ある時点で TabHost があります。スクリーンショットをご覧いただくとより印象に残るかもしれません。TabHost には 3 つのタブがあり、それぞれにインテントによって起動される別のアクティビティがあります。
1つのことを除いて、すべてが正常に機能しています。タブをクリックするたびに、Scrollview が自動的に下にスクロールします。その後、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);
}
助言がありますか?