I have an application with some kind of switchbutton, it actually is 2 textviews align at the center of the screen, I am having a problem, while I was testing the app in a JB device it all work fine, but when I tested in some GB devices the background of the textviews was messed up. This is how is showing on the JellyBean device, how it should look:

And this is how it is showing on the GingerBread devices:

Any idea what can be happening?
These are the relevant parts of the xml files:
layout_activity.xml
<LinearLayout
android:id="@+id/Layout_driver_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/Layout_Profile"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_Libre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_libre"
android:paddingBottom="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="20dp"
android:text="Libre"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
<TextView
android:id="@+id/tv_NoDisponible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_no_disponible"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp"
android:text="No Disponible"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
drawable/Background_libre.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="3dp">
<shape android:shape="rectangle" >
<corners
android:topLeftRadius="6dp"
android:bottomLeftRadius="6dp"
/>
<solid android:color="@color/libre_verde" />
</shape>
</item>
</layer-list>
drawable/Background_no_disponible.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="3dp">
<shape android:shape="rectangle" >
<corners android:bottomRightRadius="6dp"
android:topRightRadius="6dp"
/>
<solid android:color="@color/no_disponible_plomo" />
</shape>
</item>
</layer-list>
This is a known bug. Switch left with right for version 12 and under.
Like this:
<corners
android:topLeftRadius="6dp"
android:bottomRightRadius="6dp" />
Similarly for the second drawable.
You will have to place these edited(left and right reversed) drawables in res/drawable-v12 folder. Create it if it isn't present. Your regular drawables (one you posted above) will remain in red/drawable folder.
Bug is filed at: Link.
What happens if you put both textviews in a a LinearLayout, and you set the corner radii on the inner LinearLayout?
To clarify:
<LinearLayout ...>
<LinearLayout
android:topLeftRadius="6dp"
android:topRightRadius="6dp"
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"
... >
<TextView ... />
<TextView ... />
</LinearLayout>
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With