I’m new to Android and I have the following problem:
I wanted to set TextView’s background to #333. I used:
TextView title = new TextView(this);
title.setText(currentContinent);
title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
title.setBackgroundColor(0x333333);
title.setGravity(Gravity.CENTER);
Even though Eclipse marks no errors, TextView still has transparent background. What am I doing wrong?
I had a similar issue where I was creating a numeric color without considering the leading alpha channel. ie.
mytext.setTextColor(0xFF0000)(thinking this would be red ). While this is a red color it is also 100% transparent as it =0x00FF0000; The correct 100% opaque value is0xFFFF0000ormytext.setTextcolor(0xFFFF0000).In your case make it:
mytext.setTextcolor(0x33333333)