I am a beginner in android.I am using font-awesome library for icons. I want to set the icon using font-awesome in tablyout
using view pager
Create an xml layout named custom_tab.xml
custom_tab.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tab"
/>
Now set font of tab layout using below code
TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
tabOne.setText("");
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf");
tabOne.setTypeface(typeface);
tabLayout.getTabAt(0).setCustomView(tabOne);