Reputation: 575
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
Upvotes: 0
Views: 206
Reputation: 244
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!
Upvotes: 2