0

I am using TabPageIndicator with ViewPager, referred from here. My layout XML is as follow:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

     <com.viewpagerindicator.TabPageIndicator
        android:id="@+id/indicator"
        android:layout_height="35dp"
        android:layout_gravity="center_vertical"
        android:layout_width="fill_parent"
        android:paddingTop="0dp"
        android:paddingBottom="0dp"
        android:layout_margin="0dp"
        android:background="#69cbd8"
        />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        />

</LinearLayout>

And in Manifest, the activity is defined as follow :

        <activity
            android:name=".modules.results.ResultsLauncher"
            android:configChanges="orientation|screenSize"
            android:theme="@style/StyledIndicators">
            >
            <!-- android:label="Titles/With Listener" -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="com.jakewharton.android.viewpagerindicator.sample.SAMPLE" />
            </intent-filter>
        </activity>

As you can see, I had used custom style, StyledIndicators. I had referred samples downloaded from GITHUB & referred a custom style from here.

Now everything works fine. But the bottom of title of Tab is being covered. And leaving unnecessary space above. I am not able to display whole title of tab. I had attached screen shot of my screen.

I want the title "By Date" & " By Test" to be placed little bit in upper part. But couldn't find the solution.

enter image description here

hemu
  • 3,199
  • 3
  • 44
  • 66
  • attached the tabpageindicator xml file. try to add some height to – Tomer Mor Jan 09 '13 at 11:20
  • @Tomer Mor - Yes. I tried that. But I don't want it to have that much height. Above "By Date" title, it is leaving some space. I don't want it to leave that much space blank. I want to shift the text ("By Date") little bit up. But don't know from where it is calculating the padding/height.. – hemu Jan 09 '13 at 11:40
  • i created also xml file for the tabpageindicator and there you can fully control the parameters – Tomer Mor Jan 09 '13 at 11:41
  • @TomerMor - can you paste your code as answer below for my reference ?? – hemu Jan 09 '13 at 11:43

1 Answers1

1

in order to fully control your tabPageIndicator:

create XML file and inflate that xml in tabPageIndicator component

<?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="fill_parent"
    android:orientation="horizontal" >

    <include
        android:id="@+id/tab_inbox"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        layout="@layout/tab_inbox" />

    <include
        android:id="@+id/tab_dialer"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        layout="@layout/tab_dialer" />
</LinearLayout>

and from the code inflate that layout

Tomer Mor
  • 7,998
  • 5
  • 29
  • 43