How can I add a button on a WebView
?. I have a WebView and I want to show a popup. For that I need to add a button on the bottom-left corner of WebVew. How can I do this?
I would use a RelativeLayout. I like using it a lot. Its a great way to easily place and organize views,buttons,layouts,etc...
Some Example code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFD0">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<Button
android:id="@+id/My_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:text="My Button!" />
</RelativeLayout>
I think the views and buttons will be drawn in order from top to bottom in the XML, but it may be the other way around.use margins like :
android:layout_marginLeft="15dip"
and android:layout_marginBottom="10dip"
to help adjust the position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With