[英]Sit FrameLayout on top of WebView?
首先,我阅读了其他一些WebView问题,但似乎没有一个问题完全相同。
我有一个WebView
和一个FrameLayout
,FrameLayOut看起来像..
FrameLayout fl = new FrameLayout(this);
EditText qbox = new EditText(this);
box.setText(query);
Button button = new Button(this);
fl.addView(button, 45,45);
fl.addView(box,275,45);
然后,我像这样将Webview
和FrameLayout
添加到我的LinearLayout
。
LinearLayout ll = new LinearLayout(this);
webview.loadUrl(url);
ll.addView(fl,300,45);
ll.addView(webview, LayoutParams.FILL_PARENT);
但是,这很奇怪。而不是FrameLayout显示在页面顶部的Webview的“顶部”,而Webview则在右侧(大多数是页面外),而屏幕的其余部分为黑色。 为什么?
默认情况下, LinearLayout
是水平的。 如果希望LinearLayout
垂直,请使用setOrientation(LinearLayout.VERTICAL)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.