无论您在本教程中所看到的,我相信他们可能没有加载布局INTO的WebView
有时反而是along with
的WebView
。
换句话说,您实际上可以使用与HTML中的div相似的布局..您可以采用布局,将Webview添加到布局中,然后将按钮和其他控件添加到webview标记的旁边,如lgw150所示。
这可能会给人一种印象,按钮等是在web视图内,但他们实际上不是! 你可以有这样的事情:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/button1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_weight="1"/>
<Button android:id="@+id/button2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_weight="1" />
</LinearLayout>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
现在在刻度更检查出this和this too。点击我的答案左侧。
网页视图用于加载网址,而不是布局。其定义。 – Niko
你想做什么?您可能会对此类问题产生负面声誉 – Niko
如果可能,我试图将一个布局加载到WebView中。 –