0

I have these variables in colors.xml

<color name="white1">#FFFFFF</color> <!-- 100% of transparency -->
<color name="white2">#BFFFFFFF</color> <!-- 75% of transparency -->
<color name="white3">#80FFFFFF</color> <!-- 50% of transparency -->
<color name="white4">#40FFFFFF</color> <!-- 25% of transparency -->
<color name="white5">#00FFFFFF</color> <!-- 0% of transparency -->

Is there any way to pass transparency via parameters such as strings.xml in this topic or another way instead of make many variables

4
  • as far as i know no you can't. you can set a color programtically and you can also set alpha to view dynamically Commented Jun 26, 2021 at 14:52
  • @Raghunandan I'm using this view com.google.android.material.slider.Slider and this view has many attributes relating colors and if I set android:alpha="0.25" this will apply to the whole view. I wish my English is clear to understand. Commented Jun 26, 2021 at 15:07
  • you need to have those colors in colors.xml Commented Jun 26, 2021 at 16:00
  • I thought there is a better way of that, By the way thank you. Commented Jun 26, 2021 at 16:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.