setshadowlayer Android API różnice
Rozwijam Niestandardowy komponent widoku dla mojej aplikacji i zmagam się z dodaniem cienia do okręgu.
Oto kod mojej klasy Extended View
public class ChartView extends View {
public ChartView(Context context, AttributeSet attributeSet){
super(context, attributeSet);
init();
}
Paint paint;
public void init(){
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.WHITE);
paint.setStyle(Paint.Style.FILL);
paint.setShadowLayer(30, 0, 0, Color.RED);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawCircle(getWidth()/2, getHeight()/2,50, paint);
}
}
Zauważyłem jednak, że w zależności od API, istnieje duży wpływ na shadowLayer.
Oto wyjście z
<uses-sdk android:targetSdkVersion="13"/>
A oto wyjście z
<uses-sdk android:targetSdkVersion="14"/> //Higher target API yields the same output.
Jakiś pomysł, jak przezwyciężyć to niechciane zachowanie ?
Pozdrawiam
29
1 answers
setShadowLayer()
jest obsługiwane tylko w tekście, gdy akceleracja sprzętowa jest włączona. Akceleracja sprzętowa jest domyślnie włączona, gdy targetSdk=14
lub jest wyższa. Łatwym obejściem jest umieszczenie widoku w warstwie oprogramowania: myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
.
64
Author: Romain Guy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-07-01 22:22:35
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-07-01 22:22:35