java如何将webview添加到具有更多小部件的布局中
我想在布局中添加一个webview。但这种布局也很少有其他小部件。但是当我运行应用程序时,webview占据了整个屏幕,其他小部件也消失了。这是我的布局页面。xml
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓" 安卓:orientation="vertical" 安卓:id="@+id/linearLayout1" 安卓:layout_width="fill_parent" 安卓:layout_height="fill_parent" >
<WebView 安卓:layout_width="match_parent" 安卓:layout_height="200dp" 安卓:id="@+id/web"></WebView>
<View 安卓:layout_marginTop="10dp" 安卓:layout_marginBottom="10dp" 安卓:layout_height="2px" 安卓:background="#ffffff" 安卓:layout_width="fill_parent" ></View>
<TextView 安卓:text="Simple text view" 安卓:layout_width="wrap_content" 安卓:layout_height="wrap_content"></TextView>
</LinearLayout>
在活动课上
setContentView(R.layout.page);
WebView wv1=(WebView)findViewById(R.id.web);
wv1.loadUrl("http://google.com");
它不显示视图和文本视图,但webview会显示整个屏幕。请告诉我我做错了什么。或者我应该怎么做。 多谢各位
# 1 楼答案
像这样更改您的xml,然后您的textview将显示在botton上,视图将显示在textview的上方,webview将显示在其余部分
# 2 楼答案
尝试设置WebViewClient,它将解决您的问题