国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android實現(xiàn)應用程序的閃屏效果

2019-10-21 21:48:11
字體:
來源:轉載
供稿:網友

每個應用程序都會有閃屏頁面的,那么接下來就看看閃屏頁面是如何實現(xiàn)的?

效果圖:

Android,應用程序,閃屏

demo框架如下:

Android,應用程序,閃屏

1、閃屏的布局如下:其實就是一張背景圖

<?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" android:background="@drawable/bg_app" android:orientation="vertical" ></LinearLayout>

2、WelcomeActivity.java的代碼如下:

package com.example.bamboo_splash; import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.os.Handler;import android.view.animation.AlphaAnimation;import android.view.animation.Animation;import android.view.animation.Animation.AnimationListener; public class WelcomeActivity extends Activity {   @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome); /** 方式一*/// AlphaAnimation animation=new AlphaAnimation(0.3f, 1f);// animation.setDuration(3000);// animation.setAnimationListener(new AnimationListener() {// // @Override// public void onAnimationStart(Animation animation) {// // }// // @Override// public void onAnimationRepeat(Animation animation) {// // }// /** 動畫結束執(zhí)行的方法*/// @Override// public void onAnimationEnd(Animation animation) {// redirectTo();// }// });  /** 方式二*/ new Handler().postDelayed(new Runnable() {  @Override public void run() { redirectTo(); } }, 3000); } /** * 即將跳轉的頁面 */ public void redirectTo(){ Intent intent=new Intent(WelcomeActivity.this, MainActivity.class); startActivity(intent); finish(); }}

這樣一個簡單的閃屏效果就實現(xiàn)了呢,而且閃屏效果的實現(xiàn)有很多都方式,思路就是讓你開始的節(jié)面等待個幾秒鐘,然后顯示。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到Android開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 昌邑市| 信宜市| 东乌| 石河子市| 榆林市| 大足县| 丰县| 台东县| 佛教| 邢台市| 忻州市| 仪征市| 胶州市| 常州市| 咸阳市| 新密市| 赣榆县| 大厂| 固镇县| 台东县| 灵川县| 鄂托克旗| 白山市| 巴林右旗| 沾益县| 泰来县| 瓮安县| 德清县| 长寿区| 岚皋县| 腾冲县| 鹿邑县| 广州市| 肇州县| 离岛区| 朔州市| 阿拉善左旗| 武隆县| 阿合奇县| 龙岩市| 潮安县|