博客
关于我
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/

你可能感兴趣的文章
php,nginx重启
查看>>
php:$_ENV 和 getenv区别
查看>>
PHP:cURL error 60: SSL certificate unable to get local issuer certificate
查看>>
PHP:PDOStatement::bindValue参数类型php5和php7问题
查看>>
pickle
查看>>
pickle模块
查看>>
qYKVEtqdDg
查看>>
pid控制
查看>>
PID控制介绍-ChatGPT4o作答
查看>>
PID控制器数字化
查看>>
PIESDKDoNet二次开发配置注意事项
查看>>
PIGS POJ 1149 网络流
查看>>
PIL Image对图像进行点乘,加上常数(等像素操作)
查看>>
PIL Image转Pytorch Tensor
查看>>
PIL&QOOT;IOERROR:带有大图像的图像文件被截断(&Q)
查看>>
PIL.Image、cv2的img、bytes相互转换
查看>>
PIL.Image进行图像融合显示(Image.blend)
查看>>
Pillow lacks the JPEG 2000 plugin
查看>>
SpringBoot之ElasticsearchRestTemplate常用示例
查看>>
ping 全网段CMD命令
查看>>