2013-08-05 37 views
0

我有一些問題與操作欄和標籤導航。其實我想把我的標籤設置在我的操作欄上方。 (我用Sherlock Action Bar)。設置選項卡上方的操作欄

我看到有些人有問題,因爲當他們能夠做的:他們

的tabhost
ab.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> 

如果你知道如何設置我的行動吧是我的選項卡背後也可能是巨大的。 謝謝。

+0

該https://code.google.com/p/android/issues/detail?id=36191 –

+0

中有一些錯誤有一些技巧可以避免這種情況,您可以在這裏閱讀:https:// github。 com/JakeWharton/ActionBarSherlock/issues/327 –

+0

其實這就是我想要的,讓我的標籤在我的操作欄上方。但我沒有成功做到這一點。 – Substitut

回答

0

我沒有找到一個方法來做到這一點與行動欄,所以我不得不實施我自己的看法與我想要的信息。

1

我發現設置

<item name="displayOptions">homeAsUp|showTitle</item> 

在你的應用主題使標籤在上面,雖然它看起來越野車給我。

相關問題