Pregunta

I have selector for list which is based on 9-patch drawable but it looks different on android 2.+ and 4+ android based devices (LG Optimus Sol E730, Nexus 4, HTC One V): Result for android 2+

enter image description here

Result for android 4+

enter image description here

Here is code of selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/row_widget_selected" android:state_selected="true"/>
<item android:drawable="@drawable/row_widget_selected" android:state_pressed="true"/>
<item android:drawable="@drawable/row_widget_disabled" android:state_enabled="false"/>
<item android:drawable="@drawable/row_widget"/>

</selector>

Use of selector:

 <com.ssbs.sw.SWE.widget.SpinnerWidget
    android:id="@+id/dialog_outlet_task_edit_spinner_type"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?listWidgetSelector"  

And selector 9-patch drawable enter image description here

Q: As you can see the same selector looks different on android 4+, it is a gradient why is it so?

¿Fue útil?

Solución

I have found answer on my question here Android 4.2 9-patch background drawn differently than older OS versions

The easiest way to solve it is to follow the @CommonsWare proposal and move all my drawable to res/drawable-nodpi/ folder

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top