3

I'm trying to display some ancient Greek words as suggestions for a SearchView, but the native Android typefaces don't support polytonic Greek characters, so I'd like to use a custom font. I know that it's possible to alter the font of the search query using the method described in the first answer here, but I'm wondering if there's any way to do something similar for the text of the suggestions. Is there any way to globally change the font for the suggestions or to individually get a reference to the TextView for each suggestion and set its font?

Community
  • 1
  • 1
Ben
  • 1,571
  • 1
  • 13
  • 29

1 Answers1

2

Unfortunately, there is no way to globally change the font on the app.

You change the font in the code (it is not possible in xml afaik).

Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Arial.otf");
setTypeface(tf)

So you can create a new class called TextViewWithFont that extends TextView and set its font. Then use this class instead of TextViews in your layout xml files.

dors
  • 5,802
  • 8
  • 45
  • 71
  • 1
    Is there a way to specifically apply that typeface to the suggestions in the SearchView, though? That's where I'm stumped. – Ben Jun 28 '13 at 06:54
  • From a quick look at SearchView's documentation, I was not able to find access to the suggestions list items... sorry :/ – dors Jun 28 '13 at 07:35