• 欢迎界面效果


         大多数APP的欢迎界面是静态的,因为大多数欢迎界面除了准备APP的数据外,就是为了突出展示一点或者几点内容,内容展示清楚,使命也就完成了,也没必要去做动态的,做动态有点画蛇添足的感觉。但事情总有例外,比如像知乎的欢迎界面,就是一个动态的,尤其当时一个景物的背景图时,感觉像由远及近,效果还是很不错的。

        具体实现也不复杂,上代码:

    布局:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ImageView
            android:id="@+id/iv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="fitXY"
            android:src="@drawable/img"
            />
    </LinearLayout>

    Activity:

    public class SplashActivity extends Activity {
    
        Context ctx;
        ImageView iv;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.splash_layout);
            ctx=SplashActivity.this;
            iv= (ImageView) findViewById(R.id.iv);
    
    
    
    
            ObjectAnimator oax=ObjectAnimator.ofFloat(iv,"scaleX",1f,1.2F);
            ObjectAnimator oay=ObjectAnimator.ofFloat(iv,"scaleY", 1f,1.2F);
            AnimatorSet set=new AnimatorSet();
            set.setDuration(2000).play(oax).with(oay);
            set.start();
    
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                   Toast.makeText(ctx,"end",Toast.LENGTH_SHORT).show();
                }
            });
    
    
    
    
        }
    
    
    }
  • 相关阅读:
    node.js前后台交互示例 -- 使用node.js实现用户注册功能
    window对象
    ajax模仿iframe
    判断浏览器是否支持某些新属性---placeholder兼容问题解决
    jQuery简单tab按钮切换
    js函数的解析与执行过程
    js全局的解析与执行过程
    OKR解读
    《富爸爸穷爸爸》读书笔记【2020207-19】
    《金字塔原理》读书笔记【2020111-30】一读+二读
  • 原文地址:https://www.cnblogs.com/silenceshining/p/android.html
Copyright © 2020-2023  润新知