I try to put a SurfaceView on top of a RecyclerView using FrameLayout (wow that was the title :D). But even if I do not draw at all in the SurfaceView the screen gets black and I can not see the RecyclerView at all.
The three initializes in my MainActivity:
My Surface View:
surfaceView = new SurView(this, screenX, screenY);
My RecyclerView:
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
for (int i = 0; i < 100; i++) {
input.add("Test" + i);
}
mAdapter = new RealFarmAdapter(input);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(mAdapter);
if (recyclerView != null) {
ViewGroup parent = (ViewGroup) recyclerView.getParent();
if (parent != null) {
parent.removeView(recyclerView);
}
}
My FrameLayout:
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.addView(recyclerView, 0);
frameLayout.addView(surfaceView, 1);