Skip to content Skip to sidebar Skip to footer

Using Mysurfaceview With Main.xml (android)

i have a simple program on android which is drawing on user touch. here's main activity: public class DrawingActivity extends Activity { @Override public void onCreate(Bundle saved

Solution 1:

layout_width="fill_parent"

layout_height="fill_parent"

within the surfaceview tag, would solve your problem.

Solution 2:

You need to/should implement all three constructors a view can have:

//Simple constructor to use when creating a view from code.View(Context context)

//Constructor that is called when inflating a view from XML.View(Context context, AttributeSet attrs)

//Perform inflation from XML and apply a class-specific base style.View(Context context, AttributeSet attrs, int defStyle)

This was just copied from the View class constructor details in the documentation.

Post a Comment for "Using Mysurfaceview With Main.xml (android)"