2013-09-28 97 views
-2

我想開發類似附加圖像的選項卡。但是,不希望爲此使用Tabhost。任何幫助都非常值得讚賞。 enter image description here選項卡 - 不使用TabHost

下面是XML正在使用:

<?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="50dp" 
    android:background="#0C3666" 
    android:orientation="horizontal" 
    android:weightSum="1.0" > 

    <TextView 
     android:id="@+id/news_text" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.25" 
     android:background="@drawable/tab_drawable" 
     android:clickable="true" 
     android:gravity="center" 
     android:padding="10dp" 
     android:text="NEWS" 
     android:textColor="@color/main_white" 
     android:textSize="14dp" /> 

    <TextView 
     android:id="@+id/quotes_text" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.25" 
     android:background="@drawable/tab_drawable" 
     android:clickable="true" 
     android:gravity="center" 
     android:padding="10dp" 
     android:text="QUOTES" 
     android:textColor="@color/main_white" 
     android:textSize="14dp" /> 

    <TextView 
     android:id="@+id/editor_text" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.25" 
     android:background="@drawable/tab_drawable" 
     android:clickable="true" 
     android:gravity="center" 
     android:padding="10dp" 

     android:textColor="@color/main_white" 
     android:textSize="14dp" /> 

    <TextView 
     android:id="@+id/st_text" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.25" 
     android:background="@drawable/tab_drawable" 
     android:gravity="center" 
     android:padding="10dp" 
     android:text="ST" 
     android:textColor="@color/main_white" 
     android:textSize="14dp" /> 

</LinearLayout> 

以上就是佈局。我想知道我可以如何繪製分隔線「|」在標籤之間。

+0

可能重複的圖像的背景(http://stackoverflow.com/questions/13505236/how-to-implement-android-tab-menu -without-deprecated-tabhost) – r4jiv007

+0

謝謝,但你提供的鏈接是沒有用的。 – user694688

+0

使用操作欄http://www.javacodegeeks.com/2013/06/android-action-bar-with-tab.html和http://www.vogella.com/articles/AndroidActionBar/article.html可能會對您有所幫助爲你 – guptakvgaurav

回答

0

添加的ImageView與酒吧爲您希望欄的[這]

+0

是否可以做到這一點沒有圖像 – user694688

+0

@ user694688可以使用任何視圖或線性佈局添加背景色 –

相關問題