Answer the question
In order to leave comments, you need to log in
SurfaceView in layout?
Such question:
Described Surface in layout.
<SurfaceView
android:id="@+id/surfaceView1"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
setContentView(new MySurfaceView(this));
setContentView(R.layout.activity_main);
Answer the question
In order to leave comments, you need to log in
Is it
SurfaceView view = (SurfaceView) findViewById(R.id.surfaceView1);
It is clear that this will not work. Here is how to do it right: stackoverflow.com/questions/5203547/draw-surfaceview-from-layout-xml
does not work. More precisely, an empty surface view appears, the code from the class is not processed
Thanks, that's what you need.
Moreover, the second parameter had to be added to the class MySurfaceView
in the subclass , in addition to . Well, actually this is clearly indicated in the link provided, otherwise fatal exception.
The question is why is that? is called directly, and not through , then the class description without rolls. MySurfaceView
attributeSet
context
Если surfaceview
layout
attributeSet
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question