Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having trouble getting background on TextViews

 
Ashwin Sundar
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

So right now I'm building an app on competitive Pokemon, and right now I am having issues getting specific background colors depending on the text views. The layout, essentially, will be the Pokemon name followed by the type; I want the type to be associated with a certain color. Grass will be green, Electric is yellow, etc. The idea is that the type will show up next to the Pokemon name.

I don't really know how to do it in XML, so what I did in the code was created an associative array for the types, as well as the colors. I mapped each type to a color, and tried setting the backgrounds, but no background color is showing up. Below is all relevant code:

PokemonAdapter.java





TypeBackgrounds.java



MapString.java






pokedex_text_view.xml




PokedexView.java

//this is the view class




colors.xml
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic