うまくいかなかった場合android:tabStripEnabled="false"
は、呼び出しもsetStripEnabled(boolean stripEnabled)
効果がないと思います。これがすべて当てはまる場合、問題はおそらくTabWidgetにありません。
タブインジケーターを確認することをお勧めします。これらの変更を試してください。このコードは、タブを持つフラグメントから取得されます。
タブインジケータービューを作成するコードは次のとおりです。
View indicator = LayoutInflater.from(getActivity()).inflate(R.layout.tab,
(ViewGroup) mRoot.findViewById(android.R.id.tabs), false);
TabSpec tabSpec = mTabHost.newTabSpec(tag);
tabSpec.setIndicator(indicator);
tabSpec.setContent(tabContentId);
タブインジケータビューは、おそらくこれに似たものになります。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@drawable/tabselector"
android:padding="5dp" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tab1icon"/>
</LinearLayout>
ここで重要なのandroid:background="@drawable/tabselector"
はLinearLayoutです。私のはこんな感じ。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item
android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/tab_unselected_light" />
<item
android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_selected_light" />
<!-- Focused states -->
<item
android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_focused_light" />
<!-- Pressed state -->
<item
android:state_pressed="true"
android:drawable="@drawable/tab_pressed_light" />
</selector>
このtabselector.xmlは、とを交換する場所@drawable/tab_pressed_light
です。@drawable/tab_button_active
@drawable/tab_unselected_light
@drawable/tab_button_inactive
tabselector.xmlに入るすべてのドローアブルの下部に青い帯がないことを確認してください。あなたの画像を見ると、そのストリップに沿って小さな5pxのギャップがあります。これが、ストリップがTabWidgetからのものではないという考えを私に与えたものです。お役に立てれば。