博客
关于我
Android 实现欢迎界面
阅读量:118 次
发布时间:2019-02-26

本文共 1439 字,大约阅读时间需要 4 分钟。

文章目录


前言

好久没发博客了,最近太忙了


提示:以下是本篇文章正文内容,下面案例可供参考

一、欢迎页

代码如下(示例):

public class WelcomeMainActivity extends AppCompatActivity {       @Override    protected void onCreate(Bundle savedInstanceState) {           super.onCreate(savedInstanceState);        setContentView(R.layout.activity_welcome_main);        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);//隐藏状态栏        getSupportActionBar().hide();//隐藏标题栏        //\实现改功能可以使用以下4种方式        //1.sleep() 2.handler 发送延迟消息 3.Timer类  4.使用动画\        //使用动画实现  alpha:透明  利用0.7f到1.0f过渡的过程中制造几秒的停顿        ObjectAnimator animator = ObjectAnimator.ofFloat(findViewById(R.id.welcome_img),"alpha",0.7f,1.0f);        //设置动画执行时间        animator.setDuration(2000);        //动画启动        animator.start();        //监听动画是否结束        animator.addListener(new AnimatorListenerAdapter() {               @Override            public void onAnimationEnd(Animator animation) {                   super.onAnimationEnd(animation);                startActivity(new Intent(WelcomeMainActivity.this,MainActivity.class));            }        });    }}

XML中的代码就设置了一张图片

<ImageView    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/welcome_img"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:src="@drawable/welcome"    tools:context=".WelcomeMainActivity"/>

总结

以上就是欢迎页的实现了.如果有误的东西,我会尽量去改的

转载地址:http://akok.baihongyu.com/

你可能感兴趣的文章
poj 1679 判断MST是不是唯一的 (次小生成树)
查看>>
POJ 1703 Find them, Catch them
查看>>
POJ 1703 Find them, Catch them 并查集
查看>>
POJ 1738 An old Stone Game(石子合并)
查看>>
POJ 1740 A New Stone Game(博弈)题解
查看>>
Qt网络编程之实例二POST方式
查看>>
POJ 1765 November Rain
查看>>
poj 1860 Currency Exchange
查看>>
POJ 1961 Period
查看>>
POJ 2019 Cornfields (二维RMQ)
查看>>
poj 2057 The Lost House 贪心思想在动态规划上的应用
查看>>
poj 2057 树形DP,数学期望
查看>>
poj 2112 最优挤奶方案
查看>>
Qt编写自定义控件12-进度仪表盘
查看>>
poj 2186 Popular Cows :求能被有多少点是能被所有点到达的点 tarjan O(E)
查看>>
POJ 2186:Popular Cows Tarjan模板题
查看>>
POJ 2229 Sumsets(递推,找规律)
查看>>
poj 2236
查看>>
POJ 2243 Knight Moves
查看>>
POJ 2262 Goldbach's Conjecture
查看>>