Layout with unwanted black borders
In my app I have a LinearLayout
with a FrameLayout
inside. Both are setted to fill_parent
. I'm running my app in full screen mode. But even with theses params the layouts aren't inflated. The LinearLayout
remains in the center of the screen and around it, is filled with black.
I'll put some code here now:
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.TRA开发者_JAVA技巧NSLUCENT);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if(getWindowManager().getDefaultDisplay().getOrientation() == 0) {
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
setContentView(R.layout.main);
handler = new Handler();
pictureTime = 0L;
isRunning = false;
_camView = new CameraPreview(this);
((FrameLayout)findViewById(R.id.cameraFrame)).addView(_camView, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
inflater = LayoutInflater.from(this);
View overlayView = inflater.inflate(R.layout.cameraoverlay, null);
this.addContentView(overlayView,
new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
For me it's correct. SO what's the problem.
You are adding your _camView
to a FrameLayout
, so how about using:
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT));
instead of the LinearLayout
version?
If this doesn't work, please post your xml layout.
精彩评论