(未解決)Android3.0でTabWidgetをHorizontalScrollViewの中に入れたときの問題
久々にブログを書いたのに、未解決案件という…
(会社の)xoomを使って、今までに作ってきたアプリが動くか確認しようと思ったら即ハマった…
↓な感じに、TabWidgetをHorizontalScrollViewに突っ込んでいて、
<?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@android:id/tabhost"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <HorizontalScrollView android:layout_width="fill_parent" android:layout_height="wrap_content"> <TabWidget android:id="@android:id/tabs" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </HorizontalScrollView> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> </TabHost>
host.addTab( host.newTabSpec( "first" ).setIndicator( "first" , getResources().getDrawable( R.drawable.tab ) ) .setContent( new Intent( this , SomeActivity.class ) ) ); host.addTab( host.newTabSpec( "second" ).setIndicator( "second" , getResources().getDrawable( R.drawable.tab ) ) .setContent( new Intent( this , SomeActivity.class ) ) );
DHDだと↓
xoomだと↓
みたいに表示されてアレレ?ってなって、TabWidgetとかTabHostのソースとかを追ってみたんだけどよく分からなかった…
かなり微妙なワークアラウンドだけど、setIndicatorにlayout_widthを明示的に指定してあげたViewを与えるとなんとか表示された。(minWidthは効かない)
微妙…
一応ソースを上げときます。http://www1.axfc.net/uploader/Sc/so/215795.zip
2.3? 実機持ってないので誰かお願いします(ぉ