0

I read documentation about TabLayout for add property to make border on top of TabLayout but I didn't find it anywhere in documentation.

So I want some trick to make TabLayout have border on top (or maybe at bottom).

Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
Tomero Indonesia
  • 1,685
  • 2
  • 16
  • 17

3 Answers3

3

Solved with this drawable xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <stroke
                android:width="1dp"
                android:color="#FFDDDDDD" />
            <solid android:color="#FFFFFFFF" />
        </shape>
    </item>
    <item
        android:top="1dp">
        <shape android:shape="rectangle">
            <stroke
                android:width="1dp"
                android:color="#FFFFFFFF" />
            <solid android:color="#00000000" />
        </shape>
    </item>
</layer-list>

and set into tablayout attribute/property:

android:background="@drawable/drawableName"
Tomero Indonesia
  • 1,685
  • 2
  • 16
  • 17
1

Use a custom ViewPager Strip.

Try this: https://github.com/ogaclejapan/SmartTabLayout

slyidiot
  • 78
  • 9
1

you have to create a drawable, then call in this way

android:background="@drawable/yourShapeHere"

the drawable is looks like:

<?xml version="1.0" encoding="UTF-8"?>
  <shape xmlns:android="http://schemas.android.com/apk/res/android">
      <solid android:color="#FFFFFF"/>
      <stroke android:width="2dp" android:color="#515151"/>
      <corners android:radius="3dp" />
      <padding android:left="10dp" android:top="5dp" />
  </shape>
Meléndez
  • 47
  • 1
  • 6