android: Can i use different class for different child of viewflipper

后端 未结 1 491
借酒劲吻你
借酒劲吻你 2021-02-06 17:57

I have different screen to work in an android application. I\'m using ViewFlipper for this. I decided to used different class for different view children

public         


        
相关标签:
1条回答
  • 2021-02-06 18:06

    U can perfrom animation using Intent to:

    Step1: create anim folder under res directory in ur project.

    Step2: create an slideleft.xml file

    Step3: type the following code in that file

    <?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:fromXDelta="100%p" android:toXDelta="0"
            android:duration="400" />
    </set>
    

    step 4: similarly create slideright.xml

    step5: use the above code, but change the following

    <translate android:fromXDelta="-100%p" android:toXDelta="0"
                android:duration="400" />
    

    step 6:

     target.startAnimation(AnimationUtils.loadAnimation(HomeScreen.this, R.anim.slide_left));
    

    perfroming fadein operation, just add the following code in fadein.xml file

    <?xml version="1.0" encoding="utf-8"?>
    
    <alpha xmlns:android="http://schemas.android.com/apk/res/android"
           android:interpolator="@android:anim/accelerate_interpolator"
           android:fromAlpha="0.0" android:toAlpha="1.0"
           android:duration="300" />
    

    similarly for fade out too

    <?xml version="1.0" encoding="UTF-8"?>
    <alpha xmlns:android="http://schemas.android.com/apk/res/android"
           android:interpolator="@android:anim/accelerate_interpolator"
           android:fromAlpha="1.0" android:toAlpha="0.0"
           android:duration="300" />
    
    0 讨论(0)
提交回复
热议问题