我正在以编程方式生成一个Webview,我想在Webview上添加一个按钮。我能够添加一个普通的按钮,但是它出现在Webview之前,而不是在其上方。
有没有一种方法可以在Webview上添加按钮?
有没有一种方法可以在Webview上添加按钮?
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="500dp"
android:layout_weight="1"
>
<WebView
android:id="@+id/main_web "
android:layout_width="fill_parent"
android:layout_height="500dp"
android:layout_weight="1" />
<ImageButton
android:id="@+id/refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
></ImageButton>
</FrameLayout>
您可以使用FrameLayout在WebView的顶部添加按钮。
首先将WebView添加到布局中,然后添加按钮并调整按钮的重力,使其位于所需位置。