【发布时间】:2011-11-04 05:27:06
【问题描述】:
我想在我的布局中添加一个 webview。但是该布局也几乎没有其他小部件。但是当我运行应用程序时,webview 占据了整个屏幕,其他小部件消失了。这是我的布局 page.xml....
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" >
<WebView android:layout_width="match_parent" android:layout_height="200dp" android:id="@+id/web"></WebView>
<View android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:layout_height="2px" android:background="#ffffff" android:layout_width="fill_parent" ></View>
<TextView android:text="Simple text view" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
在活动类中
setContentView(R.layout.page);
WebView wv1=(WebView)findViewById(R.id.web);
wv1.loadUrl("http://google.com");
它不显示视图和 textView 但 webview 获得整个屏幕。请告诉我我在这里做错了什么。或者我应该做的正确方法是什么。 谢谢。
【问题讨论】:
-
感谢 Hossain,我认为重定向会引起 CommonsWare 那里所说的问题。 google.com 重定向到 google.lk,然后浏览器让我抓狂。
标签: java android android-layout android-widget