我有一些問題與操作欄和標籤導航。其實我想把我的標籤設置在我的操作欄上方。 (我用Sherlock Action Bar)。設置選項卡上方的操作欄
我看到有些人有問題,因爲當他們能夠做的:他們
的tabhostab.setDisplayShowTitleEnabled(false);
標籤是他們的動作條以上,但它正是我想要的。 這裏是我的代碼:
ActionBar ab = getSupportActionBar();
//getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ab.setCustomView(R.layout.action_wifisettings);
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayUseLogoEnabled(false);
ab.setDisplayShowCustomEnabled(true);
以及對應於我的行動吧xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:text="@string/wifi_title"
android:layout_marginLeft="10dp"
android:id="@+id/action_page_title"
android:layout_centerVertical="true"
android:textSize="16sp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/action_page_title"
android:layout_marginLeft="40dp"
android:textColor="#FFFFFF"
android:layout_centerVertical="true"
android:text="@string/checkbox_title"
android:id="@+id/action_checkbox_wifi"
android:textSize="16sp" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_centerVertical="true"
android:contentDescription="@string/wifi_refresh_desc"
android:background="@drawable/ic_refresh_selector"
android:id="@+id/action_wifi_refresh"
android:textSize="12sp" />
</RelativeLayout>
如果你知道如何設置我的行動吧是我的選項卡背後也可能是巨大的。 謝謝。
該https://code.google.com/p/android/issues/detail?id=36191 –
中有一些錯誤有一些技巧可以避免這種情況,您可以在這裏閱讀:https:// github。 com/JakeWharton/ActionBarSherlock/issues/327 –
其實這就是我想要的,讓我的標籤在我的操作欄上方。但我沒有成功做到這一點。 – Substitut