skip to Main Content

I was trying to use white dot as tab icon in tablayout in android studio.

I have use a example from online to define the dot:

ic_tab_default.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="0dp"
    android:shape="ring"
    android:thickness="24dp"
    android:useLevel="false">
    <solid android:color="@android:color/white"/>

</shape>

however, it became a square after I add it, how can I make it to a dot?

2

Answers


  1. Perhaps this would work

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="10dp"
        android:height="10dp"
        android:tint="#ffffff"
        android:viewportWidth="24"
        android:viewportHeight="24">
        <path
            android:fillColor="#ffffff"
            android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,9z" />
    </vector>
    
    
    
    Login or Signup to reply.
  2. tab_default.xml

    <?xml version="1.0" encoding="utf-8"?>
    <shape android:shape="oval"
        xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="#FFFFFF"/>
    </shape>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search