Android - Linear gradient does not work as expected in emulator

Viewed 198

I am testing gradients for an app and linear gradient does not work as expected for me in Pixel XL API 29 emulator, the gradient colors are not connected and looked like multiple solid color rectangles. is there a way to fix this? Also radial gradient worked for me on the emulator (the buttons bellow)

I tried testing it on a different emulator (Nexus One API 29) and it worked. I also tested it on my phone and it worked.

I like the Pixel XL API 29 emulator and if it is possible I want to fix this so I will be able to continue working with it.

The first emulator is the nexus one API 29 and to second one is the pixel XL API 29 Example

my gradient code (menu_background_gradient.xml)

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <gradient
                android:startColor="#091622"
                android:centerColor="#04090E"
                android:endColor="#0A1121"
                android:type="linear"
                />
        </shape>
    </item>
</selector>

and in my activity_main.xml I apply the gradient to LinearLayout with android:background="@drawable/menu_background_gradient"

0 Answers
Related