美文网首页
独家解析阿里高逼格动画框架及手写实现

独家解析阿里高逼格动画框架及手写实现

作者: Ahwind | 来源:发表于2019-05-12 13:51 被阅读0次

    让view根据页面滑动做动画的
    mScrollview.setOnScrollChangeListener(new OnScrollChangeListener(){
    @Override
    public void onScrollChange(View v, int scrollX,int scrollY,......){
    //不断地设置滑动属性
    view.setTranslationX(xx);
    view1.setAlpha(xx);
    }});

    方案一、只有自定义控件才能识别自定义属性
    <MyImageView
    android:layout_width="200dp"
    android:layout_height="120dp"
    android:layout_gravity="top|right"
    discrollve:discrollve_translation="fromLeft|fromBottom"
    discrollve:discrollve_alpha="true"
    android:src="@drawable/baggage"/>

    方案二、搞个自定义容器包裹系统控件来做动画
    <MyFrameLayout
    discrollve:discrollve_translation="fromRight">
    <ImageView
    android:layout_width="220dp"
    android:layout_height="110dp"
    android:src="@drawable/camera"/>
    </MyFrameLayout>

    方案三、ViewTree展现出来之前搞事!干预XML的渲染,偷偷加点东西
    LayoutInflater.inflate(xml)

    demo:https://github.com/ApeCold/Learn_Discrollve_Sample

    相关文章

      网友评论

          本文标题:独家解析阿里高逼格动画框架及手写实现

          本文链接:https://www.haomeiwen.com/subject/wkgxaqtx.html