I have a Textview with a background drawable. I want to add the alpha option but I want to set it only in the background and not affect the opacity of the text itself.
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|start"
android:layout_margin="4dp"
android:alpha="0.25"
android:background="@drawable/primary_background"
android:padding="2dp"
android:text="Unknown"
android:textColor="@color/colorWhite"
android:textSize="12sp" />
and primary background
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/colorPrimaryDark" >
</solid>
<corners android:radius="25dp" />
</shape>
But the transparency goes to the text also. How can I do that?