Search code examples
androidtabspositioning

Can I change the position of swipeable tabs in android?


I am new to android so please suggest how I can do the following. I need a text box above a tab view for which I need to position the tab view. I used ViewPager after learning a bit of it online. Can anyone suggest me anything to get what I need? I have attached an image for what I wish to create on an activity.

https://drive.google.com/open?id=0B4YOVOcFR_ChVzVoekJQbjZud3c


Solution

  • I think you can use search view,tablayout and view pager together

    <RelativeLayout 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=".SearchViewActivity" >
    
    <SearchView
        android:id="@+id/searchView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true" >
    </SearchView>
    
    
    <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    
    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    </RelativeLayout>
    

    you may look at theese links

    https://github.com/chrisbanes/cheesesquare/blob/master/app/src/main/res/layout/include_list_viewpager.xml

    https://looksok.wordpress.com/2013/06/15/android-searchview-tutorial-edittext-with-phone-contacts-search-and-autosuggestion/