0

I am using searchview in xamarin android. I have a custom font in Assets->fonts folder. I need to apply that font to my searchview hint.

I tried like below:

Typeface type = Typeface.createFromAsset(getAssets(),"fonts/Kokila.ttf"); searchView.setTypeface(type);

But its not working. Can anybody tell me how to I apply custom font to searchview hint.

Thank you

1 Answer 1

2

You need to change textview typeface that is inside the searchview.

Use that code to access the textview:

LinearLayout linearLayout1 = (LinearLayout)SearchView.GetChildAt(0);
LinearLayout linearLayout2 = (LinearLayout)linearLayout1.GetChildAt(2);
LinearLayout linearLayout3 = (LinearLayout)linearLayout2.GetChildAt(1);
AutoCompleteTextView textView = (AutoCompleteTextView)linearLayout3.GetChildAt(0);
textView.Typeface = YourCustomTypeface;

Happy codding!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.