Thursday, March 14, 2013

Android trick to make CustomTabs

i was playing around to make a custom tab style horizontal tab scrollar with left and right buttons. please have a look and modify and enhance the code according to yours need

the activity_main.xml is given below as follows


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" android:weightSum="9">



    <ImageButton android:src="@drawable/left"  android:background="#abcd" android:id="@+id/buttonl"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true" android:layout_weight="1"/>

 

    <HorizontalScrollView android:id="@+id/horizontalScroll"
        android:layout_width="200dip"
        android:layout_height="wrap_content"
        android:scrollbars="none"
        android:fadingEdgeLength="20dp" android:layout_weight="7">

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/harokLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#EEEEEE"
            android:orientation="horizontal" >

            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button1"  />
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button2"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button3"/>
           
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button4"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button5"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button6"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button7"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button8"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button9"/>
            <ImageButton android:src="@drawable/ic_launcher" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button10"/>

        </LinearLayout>

    </HorizontalScrollView>
  <ImageButton android:src="@drawable/right" android:id="@+id/buttonr"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true" android:background="#abcd" android:layout_weight="1"/>        

</LinearLayout>


the use left and right rsources are as follows







1 comment:

  1. There is a lot of competition in outsourcing software development, as there are many firms across the globe catering to clients looking for outsourcing their work. What is good is that the takers can choose the best from the lot.

    Cado Magenge

    ”http://www.appdevelopmentcompany.com.au/custom-web-development.html”
    "http://appdevelopmentcompany.com.au/iphone-application-development.html"
    ”http://appdevelopmentcompany.com.au/ipad-application-development.html”

    ReplyDelete