Original background error

I have an application with some kind of switch, in fact it is 2 textviews aligned to the center of the screen, I have a problem, while I tested the application on a JB device, everything works fine, but when I tested on some GB devices, the background Text views have been messed up. Here's how the JellyBean device looks like:

This is how it has to look like

And this is how it is shown on GingerBread devices: This is how it is showing

Any idea what could happen?

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>

range hood / 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>

range hood / 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>
+3
source share
2 answers

This is a known bug. Toggle left with right for version 12 and below.

Like this:

<corners 
   android:topLeftRadius="6dp"
   android:bottomRightRadius="6dp" />

Similarly for the second drawable.

( ) res/drawable-v12. , . ( ) red/drawable.

: .

+4

, LinearLayout LinearLayout?

:

<LinearLayout ...>
    <LinearLayout
        android:topLeftRadius="6dp"
        android:topRightRadius="6dp"
        android:bottomLeftRadius="6dp"
        android:bottomRightRadius="6dp"
        ... >

        <TextView ... />
        <TextView ... />

    </LinearLayout>
</LinearLayout>
0

All Articles