Selector with android attribute: drawable = "@ color / transparent"

<!-- Active tab --> <item android:state_selected="true" android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/tab_bg_selected" /> <!-- Inactive tab --> <item android:state_selected="false" android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/tab_bg_unselected" /> <!-- Pressed tab --> <item android:state_pressed="true" android:drawable="@color/transparent" /> <!-- Selected tab (using d-pad) --> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@color/transparent" /> 

Is there a way to get an error in this type of selector, I want to use this kind of o, but I get an error in android:drawable="@color/transparent I get this error when I run it

enter image description here

I'm running out of ideas to get the job done.

+8
android android-layout xml drawable
source share
5 answers

replace

 android:drawable="@color/transparent" 

from

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

You must access the android namespace

+25
source share

Try writing a line of code for transparency like this:

  <item android:drawable="@android:color/transparent"/> 
+3
source share

Replace android:drawable with android:color and put the color code of the color here. those. android:color="#00000000" .

+1
source share
 android:drawable="@color/transparent" 

not used by default in the Android infrastructure. And if you want, you need to do it manually. So you need to change this from

 android:drawable="@color/transparent" 

to

 android:drawable="@android:color/transparent" 
+1
source share

You can use this code:

 android:background="any color u want" android:alpha=".6" 

It will give you color with transparent background.

0
source share

All Articles