Change size layout ImageView when WebView scrolls

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Change size layout ImageView when WebView scrolls



I have a project with Android Studio and in Activity I have content html using WebView. The Image should be shown as an ImageView to make it look good. I want to change the height of the ImageView when I scroll the WebView to the bottom and then back to normal size when I scroll back to the top. How can enable it?



Here is my xml code:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:background="#ffffff"
android:orientation="vertical"
tools:context="com.demowordpress.app.DetailActivity">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="220dp">
<ImageView
android:id="@+id/imageView"
android:scaleType="center"
android:layout_width="match_parent"
android:layout_height="220dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom">

<TextView
android:padding="10dp"
android:id="@+id/textView"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:ellipsize="end"
android:maxEms="10"
android:maxLines="3"
android:background="@android:drawable/screen_background_dark_transparent"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
</LinearLayout>

</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/wv"
android:scrollbars="none"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:visibility="gone">
</WebView>
<ProgressBar
android:id="@+id/pBar"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<Button
android:id="@+id/Button"
android:layout_width="80dp"
android:layout_height="80dp"
android:focusable="true"
android:clickable="true"
android:visibility="gone"
android:drawableTop="@drawable/ic_retry"
android:text="try Again"
android:textColor="@color/colorPrimary"
android:background="@android:color/transparent"
android:layout_gravity="center"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/white"
android:clickable="true"
ads:srcCompat="@drawable/ic_share"
app:backgroundTint="@color/white"
android:layout_gravity="end|bottom"
android:layout_marginBottom="50dp"
android:layout_marginRight="40dp"
/>
</FrameLayout>

</LinearLayout>









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS