Android O introduces a new feature, Fonts in XML, which lets you use fonts as resources. And I am creating the font folder in resource file as it provided by Android developer, but the problem is that I am getting error that file name must end with .xml while using the font folder which is provided in Android O release.
Please check the below layout for it.
<TextView
android:id="@+id/txtMsgCount"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:background="@drawable/msg_count"
android:gravity="center"
android:text="123"
android:fontFamily="@font/Montserrat_Regular" ////IT IS MY FONT STYLE
android:textColor="@android:color/white"
android:textSize="10sp" />
And please check the font folder which I have created in res with Montserrat_Regular.otf file
I am getting the following error while using the above, which are as follows:
I have searched about it but did not get expected result, please check:
1. First Link
2. Second Link
3. Third Link
4. Forth Link
And the Font resource file is not creating as I am clicking the Right-click the font folder and go to New > Font resource file. But not getting the option of the Font resource file, please check below:


