i have a list of chapters in a list.when user selects a chapter it get expanded and sub topics in that chapter lists. when user select the particular sub topic its contents get loaded in webview on new screen. its all done fine. But i want some functionality on webview. When user slide up the webview, webview should move up side and a new webview from bottom to upside should appear on screen (slide up animation on webview) with next subtopics contents. same in case of slide down when user slides down web view with previous subtopics contents.
Please help how to provide slide up and slide down animation on webview. Thanks
Create XML File to Define Animation To use Slide Up or Slide Down animations in our android applications, we need to define a new XML file with <scale> tag like as shown below. For Slide Up animation, we need to set android:fromYScale="1.0" and android:toYScale="0.0" like as shown below.
You can use the view animation system to perform tweened animation on Views. Tween animation calculates the animation with information such as the start point, end point, size, rotation, and other common aspects of an animation.
The animations are basically of three types as follows: Property Animation. View Animation. Drawable Animation.
Apply animation to webview..
Slide down.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:toYDelta="100%p" android:duration="2000" />
</set>
Slide Up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromYDelta="100%"
android:toXDelta="0"
android:duration="1000" />
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="500" />
</set>
Use Wbeview startAnimation method
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