[英]Layout with unwanted black borders
In my app I have a LinearLayout
with a FrameLayout
inside. 在我的应用程序中,我有一个带有
FrameLayout
的LinearLayout
。 Both are setted to fill_parent
. 两者都设置为
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. LinearLayout
保留在屏幕的中心,并在其周围填充黑色。 I'll put some code here now: 我现在将一些代码放在这里:
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
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: 您将
_camView
添加到FrameLayout
,那么如何使用:
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT));
instead of the LinearLayout
version? 而不是
LinearLayout
版本?
If this doesn't work, please post your xml layout. 如果这不起作用,请发布您的xml布局。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.