不少應用在設計的時候都會有幾個引導界面,這里總結一下幾個典型實現:
之前自己做過僅具有一個引導界面的應用,在welcomeActivity中設置一張圖片,更復雜的為該圖片設置一個漸入漸出的動畫,然后利用new handler的postdelay方法跳轉到另一個界面。
new Handler().postDelayed(new Runnable(){ @Override public void run(){ Intent intent = new Intent (GuideViewDoor.this,OtherActivity.class); startActivity(intent); GuideViewDoor.this.finish(); } }, 2300);
下面是幾個具有多個引導界面的示例:
http://www.apkbus.com/android-125505-1-1.html?from=threadlink
具有微信動畫效果的引導:
http://www.apkbus.com/android-125507-1-1.html?from=threadlink
類似於人人開機動畫的引導:
http://www.apkbus.com/android-125509-1-1.html?from=threadlink
實現僅第一次使用時候顯示開機引導界面的功能:
上面幾個引導界面的實現都是借助於viewpager通過左右滑動來實現,而這款人人引導界面的實現則是幾張圖片的動畫展示和自動切換。
http://www.apkbus.com/android-125509-1-1.html?from=threadlink
用到了漸現、放大、漸隱幾類動畫資源。通過監聽動畫的播放事件,在動畫結束的時候進行監聽來實現。
//重寫動畫結束時的監聽事件,實現了動畫循環播放的效果 @Override public void onAnimationEnd(Animation animation) { if (index < (animations.length - 1)) { //一個圖片需要顯示所有3種動畫 //在結束之后開始下面一條動畫 ivGuidePicture.startAnimation(animations[index + 1]); } else { //顯示下面一個圖片 currentItem++; //如果3副圖片都展示完畢,那么回歸第一幅圖片 if (currentItem > (pictures.length - 1)) { currentItem = 0; } ivGuidePicture.setImageDrawable(pictures[currentItem]); ivGuidePicture.startAnimation(animations[0]); } } @Override public void onAnimationRepeat(Animation animation) { } }
只在第一次啟動的時候展示引導界面:
http://www.apkbus.com/android-125513-1-1.html?from=threadlink