Note that there are some explanatory texts on larger screens.

plurals
  1. POMy Camera view is overlapping GLSurfaceView... but i want that it gets overlayed by GLSurfaceView
    primarykey
    data
    text
    <p>I have an augmented reality app that shows the the camera view and a GLSurfaceView with a polygon that can be rotated touching the screen. The main layout of my app is a FrameLayout. The frameLayout contains the cameraView and the GLSurfaceView. My app also have two buttons on the screen (zoom in/out) on a RelativeLayout overlaying the cameraView.</p> <p>The problem is that the cameraview is overlapping the other two views (the zoom buttons, and the GLSurfaceView with the polygon), i only can see the cameraView on the screen. If i remove the cameraview from the main FrameLayout of my app then i can see the GLSurfaceView and the zoom buttons without problems.</p> <p>How can i solve this? i need that the GLSurfaceView overlays the cameraView and the RelativeLayout with the zoom buttons overlays the GLSurfaceView...</p> <p>Some updates: </p> <p><em>i checked that in Android 2.2.2 (motorola Droid) it works perfect, but if i test it on versions from 1.5 to 2.1, then it works bad, the cameraview overlapps the other views...</em></p> <p><em>i checked also that if i invert the position of the views on the contentview of my app (first the GLSurfaceView, after the camera and finally the buttons), then works on android 1.5 to 2.1... but then doesn't works on android 2.2.2 and upper versions!!! i'm going crazy with this...</em></p> <p>THis is the code:</p> <pre><code>public class ARLambo3DSample extends Activity { private CustomCameraView cv=null; private ImageView minus; private ImageView plus; private MySurfaceView mySurfaceView; private boolean pressed=false; //algún boton de zoom pulsado private boolean zoomIn=false; //si zoomIn=true entonces hace zoomIn y si es false hace zoomOut private myThread t1; //Hilo que gestiona el zoomIn y el zoomOut public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout fl = new FrameLayout(this.getApplicationContext()); cv = new CustomCameraView(this.getApplicationContext()); RelativeLayout rl= new RelativeLayout(this.getApplicationContext()); //turn off the window's title bar requestWindowFeature(Window.FEATURE_NO_TITLE); //fullscreen this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); fl.addView(cv); minus= new ImageView(getApplicationContext()); minus.setImageResource(R.drawable.minus2); rl.addView(minus); plus= new ImageView(getApplicationContext()); plus.setImageResource(R.drawable.plus2); rl.addView(plus); Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int w = display.getWidth(); int h = display.getHeight(); RelativeLayout.LayoutParams minusPosition = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams plusPosition = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); minusPosition.leftMargin = (int)(w*0.77); minusPosition.topMargin = (int)(h*0.80); //0.66 si no es fullscreen minus.setLayoutParams(minusPosition); plusPosition.leftMargin = (int)(w*0.88); plusPosition.topMargin = (int)(h*0.80); plus.setLayoutParams(plusPosition); mySurfaceView = new MySurfaceView(this); setContentView(fl); plus.setClickable(true); //esto es necesario para poder gestionar cuando el boton se presiona y se suelta minus.setClickable(true); //esto es necesario para poder gestionar cuando el boton se presiona y se suelta minus.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: //boton presionado zoomIn=false; pressed=true; break; case MotionEvent.ACTION_UP: //boton se suelta pressed=false; break; } return false; } }); plus.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: //boton presionado zoomIn=true; pressed=true; break; case MotionEvent.ACTION_UP: //boton se suelta pressed=false; break; } return false; } }); t1= new myThread(); t1.start(); fl.addView(mySurfaceView); fl.addView(rl); } protected void onResume() { super.onResume(); mySurfaceView.onResume(); } protected void onPause() { super.onPause(); mySurfaceView.onPause(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload