Usually we use when drawing View or SurfaceView is doing, in the onCreate () method where :
setContentView (new MySurfaceView (this));
and inner classes defined in the Activity
MySurfaceView extends SurfaceView implements SurfaceHolder.Callback {
...
}
but this will be used to draw the entire Activity , part of how to make Activity drawing, another part of the usual display additional Widget ( such as Button, TextView , etc. ) ?
passing prawn help answer , thank you !
------ Solution ---------------------------- ----------------
setContentView () set the layout of this place
layout which contains a ViewGroup graphics devoted to painting , the painting good graphics as subview join.
------ Solution ---------------------------------------- ----
MySurfaceView extends SurfaceView implements SurfaceHolder.Callback {
}
setContentView (R.layout.main);
ViewGroup view1 = (ViewGroup) findViewById (R.id.myview);
view1.add (new MySurfaceView ());
------ Solution ------------------------- -------------------
can also use it
------ eference ------------- Fragment --------------------------
Thank you !
ViewGroup view1 = (ViewGroup) findViewById (R.id.myview); here myview is activity_main.xml inside a defined node do ? How activity_main.xml this layout file to define this myview?
------ Eference -------------------------- -------------
Oh, I see, here is the entire layout file activity_main.xml myview the id name . Thank you for it !
没有评论:
发表评论