Pergunta

<!--  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 the error in this kind of selector i want to use this kind o selector but i get an error in android:drawable="@color/transparent i get this error when i run it

enter image description here

i run out of ideas to do on make it work

Foi útil?

Solução

replace

android:drawable="@color/transparent"

with

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

You should refer to the android namespace

Outras dicas

Try writing the line of code for transparency like this:

 <item android:drawable="@android:color/transparent"/>
android:drawable="@color/transparent" 

is not used in android framework by default. And if you want to need it you have to make manually. So you need change this from

android:drawable="@color/transparent" 

to

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

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

You may use this code:

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

It'll give you a colour with tranparent background

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top