paint - Android drawCircle compatibility problems -


i've got custom widget - blinking circle in custom frequency. in ondraw method paint circle.

@override protected void ondraw(canvas c) {   super.ondraw(c);   if (data[mbitindex] == '1'){     c.drawcircle(c.getwidth() / 2, c.getheight() / 2, c.getwidth() / 2, mpaint);   } } 

this works perfect on android 4.2.1, if try on android 2.3, no circle shown. i've done experiments determine problem

@override protected void ondraw(canvas c) {   super.ondraw(c);   if (data[mbitindex] == '1'){     c.drawcolor(mpaint.getcolor());   } } 

this works expected on both versions of android. but, it's square, not circle, want.

how possible draw square, not circle? i've searching on internet, noone has problem before or it's problem. don't this, can explain me mistake?

on honeycomb (api 13) or earlier, hardware acceleration buggy , cannot draw circle. disable hardware acceleration view:

setlayertype(view.layer_type_software,null); 

this worked me.

or set targetsdkversion 14 or higher (which might cause other issues).


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -