Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slide up and Slide down animation on Webview in Android

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

like image 216
rahul sapra Avatar asked Dec 08 '11 09:12

rahul sapra


People also ask

How to add slide animation in Android?

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.

How do I animate a view in Android?

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.

Which are the types of animations supported in Android explain any one in detail?

The animations are basically of three types as follows: Property Animation. View Animation. Drawable Animation.


1 Answers

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

like image 86
Dhaval Khant Avatar answered Sep 22 '22 01:09

Dhaval Khant