Code example for View

Methods: setLayerType

0
        layout.setOrientation(LinearLayout.VERTICAL);
 
        View view = new PathView(this);
        layout.addView(view, new LinearLayout.LayoutParams(PathView.SIZE, PathView.SIZE));
        view = new PathView(this);
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        layout.addView(view, new LinearLayout.LayoutParams(PathView.SIZE, PathView.SIZE));
 
        setContentView(layout);
    } 
 
    static class PathView extends View {
        private static final int SIZE = 37;
        private final Paint mPaint;
        private final Path mPath;
 
        PathView(Context c) {
            super(c);
 
            mPath = new Path();