简体   繁体   中英

How to make each tab corner of Tablayout round shape in android?

I am using Tab Layout in my app. Now what I want is to make each tab corner round shape. So please help me to get rid of it.

Here I attached some screenshots.

I have as below Image :

这是我有

I want as below Image:

这是我想要的

Any kind of help will be appreciated.

Thanks in advance.

I think you should use segment library to replace Tab Layout because it faster and customize simply

[android-segmented-control][1]

You have to create drawable for that and set it to your views refer to drawable below, copy into drawable file:

you can change radius value to change sharpness of corner

<?xml version="1.0" encoding="utf-8"?>

<solid android:color="@color/primary" />

<padding
    android:left="1dp"
    android:right="1dp"
    android:top="1dp" />

<corners android:radius="3dp" />

use android:background="@drawablw/round_corner" attribute of your view to set that drawable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM