Drawing native components on Game canvas

I want to add Android native components on top of the Game canvas. I am able to add the components by using

[java] addContentView(view,new FrameLayout.LayoutParams(300,100));[/java]

How can i change(reduce) viewing screen width and height of the canvas?

Is there any other method like handling canvas by keeping it as a Custom view in the Android XML files so that i can design the whole screen as required?

Any possibility to use Canvas in Fragments?

Thanks in Advance

I fixed this my self.

I modified the jmonkey source according to my requirement as shown below.

Changes at library end.

In (AndroidHarness.java)

  1. I changed the [java]GLSurfaceView view[/java] protected to public.
  2. Commented [java]setContentView(view)[/java] line of code in the method layoutDisplay() .

    Now build the library again and use this in your actual application.

    Changes at project end.
  3. Open the java file which extends the AndroidHarness in jmonkey library.
  4. Create your own layout file and create your own design in it.
  5. add a layout to it where you want to display the openGL view.
  6. Check the below piece of code to handle the view

    [java] appClass = “com.xxxx.xxxx.Game”;

    eglConfigType = ConfigType.BEST;


    exitDialogTitle = “Exit?”;

    exitDialogMessage = “Press Yes”;

    eglConfigVerboseLogging = false;



    RelativeLayout rl = (RelativeLayout)findViewById(R.id.glview);

    rl.addView(view);//view is the variable of AndroidHarness which is accessed by changing its access.[/java]

    That’s it. Enjoy the way you want to be.

Note that these elements will not work on any other platforms but android (e.g. iOS in the future)