1
我正在使用自定義曲面視圖。但平局不出現,看法是全黑:自定義SurfaceView:不會出現
public class SV extends SurfaceView {
Context context;
public SV (Context a_context)
{
super(a_context);
context = a_context;
}
@Override
public void draw (Canvas c)
{
c.drawColor(0xFFFF0000);
Paint p = new Paint();
p.setColor(0xFFFFFFFF);
c.drawCircle(c.getWidth()/2, c.getHeight()/2, 150, p);
}
@Override
public void onDraw (Canvas c)
{
c.drawColor(0xFF0088FF);
}
}
和活動的onCreate:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
SV sv = new SV (this);
setContentView(sv);
}