0

There is a tablelayout having four tablerows, the first tablerow contains a TextView :

enter image description here

As you can see the background of the TextView having the text "Vidy" is seen ! So how to make it transparent ? I tried to add android:alpha="0" to the attribute of the TextView but at runtime the text is not seen !

pheromix
  • 18,213
  • 29
  • 88
  • 158

2 Answers2

2

You can try:

android:background="@null"

Or:

android:background="@android:color/transparent"

Check also: Android Transparent TextView?

Community
  • 1
  • 1
Nermeen
  • 15,883
  • 5
  • 59
  • 72
2

If you really need transparency, @Nermeen's answer is great, you can also get it done programmatically like:

myTextView.setBackgroundColor(Color.TRANSPARENT);

but as long as you have solid background color below, it's better due to performance to make your TextView's background color the same as the layout below (with alpha, app needs to redraw more regions). It won't really matter for such a simple layout, but it's worth remembering when you have many of them using transparency.

cyborg86pl
  • 2,597
  • 2
  • 26
  • 43