Friday, March 7, 2014
Ask: How to make Activity under Android drawing without taking part for the other part of the whole display other controls Activity
Usually we use when drawing View or SurfaceView is doing, in onCreate () method in:
setContentView (new MySurfaceView (this));
And define the inner class
in the ActivityMySurfaceView extends SurfaceView implements SurfaceHolder.Callback {
...
}
But this will be used to draw the entire Activity, how to make a part of Activity to draw, another part of the usual display of other Widget (such as Button, TextView, etc.)?
Passing prawn help answer, thank you!
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
setContentView () to set the layout of this place
ViewGroup layout which contains a painting dedicated to graphics, the graphics drawing a good view as a child to join.
Reply:
MySurfaceView extends SurfaceView implements SurfaceHolder.Callback {
}
setContentView (R.layout.main);
ViewGroup view1 = (ViewGroup) findViewById (R.id.myview);
view1.add (new MySurfaceView ());
Reply:
It can also be used Fragment
Reply:
Thank you!
ViewGroup view1 = (ViewGroup) findViewById (R.id.myview); activity_main.xml here myview is defined in a node do? How to define this myview in activity_main.xml this layout file?
Reply:
Oh, I see, here is the entire layout of the document activity_main.xml myview the id name. Thank you for it!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment