有谁知道我怎样才能获得具有以下描述的 View : 在页面顶部有一个自定义测试,下面显示了来自 url 的内容。目前我的布局如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@id+/test"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
在紧贴此布局的应用程序创建过程中,我使用 findViewById 获取 TextView 并为其设置文本。类似地,我得到 WebView 并为其调用 loadUrl("url"),但行为不是预期的。首先会短暂显示文本集,然后会显示一个全屏浏览器页面,其中包含传递的 url 中的内容。
最佳答案
将 android:layout_weight='1'
添加到 WebView。
关于android - 显示 WebView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2850709/