Align ImageView inside WebView

Diego Vieira :

I need to align the image on right bottom of WebView, but the image is always on left top.

I've already tried use the solutions in this topic, but without success: Align ImageView to bottom Right of LinearLayout.

Is there another way to do this?

My XML:

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

    <WebView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView android:id="@+id/imageBack"
            android:layout_height="50dp"
            android:layout_width="50dp"
            android:src="@drawable/logo_mosaic"
        />
    </WebView>
</LinearLayout>
Dipankar Baghel :

You can try below code to achieve -

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

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


    </WebView>
    <ImageView android:id="@+id/imageBack"
               android:layout_height="50dp"
               android:layout_gravity="bottom|right"
               android:layout_width="50dp"

               android:src="@drawable/logo_mosaic"
    />

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=7324&siteId=1
Recommended