Search code examples
androidcustom-titlebar

custom title bar linked with mutiple activites


Hello people I have made a custom title bar for my app. I would like to know if this is not to much code just for a title bar. the reason I ask is that I want like a group activity but I don't like tab-host because I tried it and I didn't like it. so I like a title-bar instead of tab-host

      <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/pt5"
      android:orientation="vertical" >

<FrameLayout
    android:id="@+id/frameLayout1"
    android:layout_width="match_parent"
    android:layout_height="50dp" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" android:background="@drawable/tilte2">

        <Button
            android:id="@+id/button1"
            android:layout_width="108dp"
            android:layout_height="fill_parent"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:background="@null" android:drawableBottom="@drawable/info_btn"/>

        <Button
            android:id="@+id/button3"
            android:layout_width="105dp"
            android:layout_height="fill_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:background="@null" android:drawableBottom="@drawable/car_key"/>

        <Button
            android:id="@+id/button2"
            android:layout_width="105dp"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true"
            android:layout_toRightOf="@+id/button3"
            android:background="@null" />
    </RelativeLayout>
</FrameLayout>

thank you


Solution

  • TabActivity is the one of the usefull feature of the Android.If you don't want to use it and if you want to make custom tab-bar then you can create one abstract activity and create a tab-bar in that and after that in what ever activity you want to use the tab-bar you can extends that abstract class.

    Here is the link which you can refer as a option of tab-bar.