-1

I want to develop tabs like the attached image. But, do not want to use Tabhost for this.Any help is highly Appreciated.enter image description here

Below is the XML am using:

<?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>

Above is the layout. I want to know how i can draw the separtor line "|" between tabs.

user694688
  • 593
  • 1
  • 15
  • 32
  • possible duplicate of [this](http://stackoverflow.com/questions/13505236/how-to-implement-android-tab-menu-without-deprecated-tabhost) – r4jiv007 Sep 28 '13 at 10:19
  • Thanks, but the link you have provided is not helpful. – user694688 Sep 28 '13 at 10:21
  • Use action bar http://www.javacodegeeks.com/2013/06/android-action-bar-with-tab.html and http://www.vogella.com/articles/AndroidActionBar/article.html may be helpful for you – Gaurav Gupta Sep 28 '13 at 10:22
  • then give some more detail like where do u want to show it , else action bar can be used for general cases – r4jiv007 Sep 28 '13 at 10:23
  • 1
    Did you at least tried something? You could use Buttons, TextViews custom views etc... – user Sep 28 '13 at 10:34
  • am using four TextViews in horizontal linear layout. Now, am able to set the selected and unselected state also for the tabs. One issue am facing now is in drawing the separator "|" between tabs. How can i achieve this. – user694688 Sep 28 '13 at 10:44
  • For that vertical line you could use a simple `View` class(placed between the `TextViews` with a small width) for which you'll set the background to color you want. – user Sep 28 '13 at 11:28

1 Answers1

0

Add the ImageView with bar as background of image where you want bar

Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64