Note that there are some explanatory texts on larger screens.

plurals
  1. POSurfaceView did not draw border
    primarykey
    data
    text
    <p>I have an android application showing coverflow animation.I want to use view extending surfaceview inside coverflow.But this code did not show anything.</p> <pre><code>public class CoverFlowView extends SurfaceView implements Callback { public CoverFlowView(Context context) { super(context); } public CoverFlowView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CoverFlowView(Context context, AttributeSet attrs) { super(context, attrs); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder) { MyThread myThread = new MyThread(holder); myThread.setFlag(true); myThread.start(); } public void surfaceDestroyed(SurfaceHolder holder) { } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint borderPaint = new Paint(); borderPaint.setARGB(255, 255, 128, 0); borderPaint.setStyle(Paint.Style.STROKE); borderPaint.setStrokeWidth(4); canvas.drawRect(0, 0, getWidth() - 1, getHeight() - 1, borderPaint); } class MyThread extends Thread { boolean flag; SurfaceHolder myHolder; public MyThread(SurfaceHolder holder) { myHolder = holder; } public void setFlag(boolean myFlag) { flag = myFlag; } public void run() { Canvas canvas = null; while (flag) { try { canvas = myHolder.lockCanvas(); synchronized (myHolder) { invalidate(); } } finally { if (canvas != null) { myHolder.unlockCanvasAndPost(canvas); } } } } } } </code></pre> <p>What is the problem here?I am new with Surfaceview.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload