This link will certainly solve your goal, and you too will be able to understand the work.
OR
you can do it simply (only one color will be applied to the whole font of the header / source list with this code, but you can customize it):
circle.xml in the selected project folder
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/color_accent" />
</shape>
(xml) TextView
, :
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/circle"
android:gravity="center_vertical" />
title TextView
, : title.setText(dataList.get(i).charAt(0))
.