Question

I am creating a style xml document, and I've ran into a problem. I want to use the droid serif font, but I can't use it in an emulator, only in the preview screen in Eclipse. Sometimes I can write <Item name="android:typeface">2</item> without getting an error, but when I try to run the program in the Android Emulator, I get an error: error: Error: Integer types not allowed (at 'android:typeface' with value '2'). When i press ctrl+space to see what I can write it shows (among others) serif, however when i write <Item name="android:typeface">serif</item> it says The word 'serif' is not correctly spelled..

Here's the part from the .xml file:

<style name="Header">
  <item name="android:layout_width">wrap_content</item>
  <item name="android:layout_height">wrap_content</item>
  <item name="android:textColor">#444444</item>
  <item name="android:paddingBottom">15dp</item>
  <item name="android:gravity">center</item>
  <item name="android:typeface">serif</item>
</style>
Was it helpful?

Solution

Eclipse has a spell checker for string values in XML...usually you get the "not correctly spelled" thing if it is a word that the spell checker does not recognize. It should still compile and work though, if this is actually the case. Maybe that's what's going on here?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top