[英]Sit FrameLayout on top of WebView?
First off, I have read some of the other WebView questions and none of them appear to be having quite the same problem. 首先,我阅读了其他一些WebView问题,但似乎没有一个问题完全相同。
I've got a WebView
and a FrameLayout
, the FrameLayOut looks something like.. 我有一个
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);
I then add the Webview
and FrameLayout
to my LinearLayout
like so.. 然后,我像这样将
Webview
和FrameLayout
添加到我的LinearLayout
。
LinearLayout ll = new LinearLayout(this);
webview.loadUrl(url);
ll.addView(fl,300,45);
ll.addView(webview, LayoutParams.FILL_PARENT);
However, this renders weirdly.. rather than the FrameLayout displaying "on top of" the Webview it renders at the top of the page, with the webview to the right (mostly off page) and the rest of the screen black. 但是,这很奇怪。而不是FrameLayout显示在页面顶部的Webview的“顶部”,而Webview则在右侧(大多数是页面外),而屏幕的其余部分为黑色。 Why?
为什么?
LinearLayout
is horizontal by default. 默认情况下,
LinearLayout
是水平的。 If you want the LinearLayout
to be vertical, use setOrientation(LinearLayout.VERTICAL)
. 如果希望
LinearLayout
垂直,请使用setOrientation(LinearLayout.VERTICAL)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.