• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Having trouble getting background on TextViews

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Why fit in when you were born to stand out? - Seuss. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic