Android: api 16 draws a rectangle outline as a filled rectangle

The following api 21 code shows the outline of a rectangle with a black border of 1 px width:

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="1dp" android:color="#000000" /> <size android:width="300dp" android:height="50dp"/> </shape> 

However, on api 16 I see a solid black rectangle. Why is this a workaround?

Edit: in logcat, I see continuous messages:

 HardwareRenderer﹕ draw surface is valid dirty= Rect(107, 214 - 109, 251) 
+5
source share
1 answer

I had the same problem a few weeks ago. Finally I added a transparent body. Try:

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="1dp" android:color="#000000" /> <size android:width="300dp" android:height="50dp"/> <solid android:color="@android:color/transparent" /> </shape> 
+7
source

All Articles