MMK Devs.
MMK Devs.

Reputation: 19

Support Gujarati fonts in recycler view in android

I am currently working on an android application which needs Gujarati font support. I have tried the typeface method but all in vain. I tried to find the solution on internet but didn't quiet get the solution. I am using recycler view in which I need to display the text view using Gujarati fonts. I kindly request you to help me with this.

Thanx in advance .... :):)

Here is the method i used to add custom gujarati fonts in the ViewHolder method of RecyclerView

    public ViewHolder(View v) {
        super(v);


        mNameTextView = (TextView) v.findViewById(R.id.nameTextView);

        Typeface tf = Typeface.createFromAsset(v.getContext().getAssets(), "fonts/guj.ttf");

        this.mNameTextView.setTypeface(tf);
        this.mNameTextView.setTextColor(Color.DKGRAY);


    }

Upvotes: 1

Views: 417

Answers (2)

MMK Devs.
MMK Devs.

Reputation: 19

Finally got the Solution. All i needed was the official google NotoSansGujarati font which can be downloaded from the given link. https://www.google.com/get/noto/

public ViewHolder(View v) { super(v);

        mNameTextView = (TextView) v.findViewById(R.id.nameTextView);

        Typeface tf = Typeface.createFromAsset(v.getContext().getAssets(), "fonts/NotoSansGujarati-Bold.ttf");

        this.mNameTextView.setTypeface(tf);
        this.mNameTextView.setTextColor(Color.DKGRAY);


    }

Upvotes: 1

Sai Kiran Mudulkar
Sai Kiran Mudulkar

Reputation: 21

If you're using Android 5.0 (Lollipop), Google has added fonts.

The fonts are called Noto Sans Gujarati and Noto Sans Gujarati UI.

As you're working on an application, that has to be compatible for all the Android Versions, you have to root the particular device for that to work on.

Reference 1

Reference 2

Upvotes: 0

Related Questions