我想開發類似附加圖像的選項卡。但是,不希望爲此使用Tabhost。任何幫助都非常值得讚賞。 選項卡 - 不使用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>
以上就是佈局。我想知道我可以如何繪製分隔線「|」在標籤之間。
可能重複的圖像的背景(http://stackoverflow.com/questions/13505236/how-to-implement-android-tab-menu -without-deprecated-tabhost) – r4jiv007
謝謝,但你提供的鏈接是沒有用的。 – user694688
使用操作欄http://www.javacodegeeks.com/2013/06/android-action-bar-with-tab.html和http://www.vogella.com/articles/AndroidActionBar/article.html可能會對您有所幫助爲你 – guptakvgaurav