Question

What I want to create should look like this :

enter image description here

I want it like this because I want the button to cover a part of the content of the webview making it unreachable for the user.

Was it helpful?

Solution

You can do it using FrameLayout as follows...

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:text="Button" />

</FrameLayout>

OTHER TIPS

Yes You can do.for that purpose you have to use relative layout.first you have add webview,then add image button and set gravity bottom to image button.i think this can help you.

 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <WebView 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="20dp"
            />
        <ImageButton 
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:background="@android:color/darker_gray"
            android:layout_alignParentBottom="true"
            />
    </RelativeLayout>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top