If I have <color name="primary">#112233</color>,
- Can I set
android:backgroundattribute toprimary, but adding opacity? For example, adding #40000000 to get#40112233. - Can I make another color, basing on primary, but adding opacity? For example, make something like
<color name="primary_semitransparent">#40000000 + @color/primary</color>to produce@color/primary_semitransparentwith value of#40112233
This isn't an exact duplicate, but this question gets answered in How to create a transparent Color Resource? pretty well.
To answer the question here as well:
If you use 8 characters for a color then the first 2 will be used for opacity. So to greate a half transparent "primary" use:
<color name="primary">#CC112233< /color>.