0

I have a custom_row.xml which will become part of ListView using BaseAdapter

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
 android:background="anyBackgroundColor(#HexValue)">

     inner content has text view of white color

  </RelativeLayout>

enter image description here

After apply alpha property to RelativeLayout the text color becomes little faint.

enter image description here

I don't want the text to become faint and also achieve transparency on my background color which is not an image. How we can achieve this?

Shoaib Chikate
  • 8,665
  • 12
  • 47
  • 70

1 Answers1

0

When you apply alpha to layout, you are effectively applying alpha on everything that layout contains. That is why your text has become partially transparent too.

Hex value of colors in Android is defined as AARRGGBB - alpha, red, green and blue. So changing AA (00 - fully transparent, FF - opaque) part of color hex code will give your layout background color transparency, leaving other views it contains intact.

For instance

android:background="#66D500F9" -> alpha part is 66
Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159