最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實(shí)現(xiàn)閃屏歡迎界面

 更新時(shí)間:2021年09月16日 10:57:30   作者:ami_daqi  
這篇文章主要介紹了Android實(shí)現(xiàn)閃屏歡迎界面的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

閃屏:在打開(kāi)App時(shí),展示,持續(xù)數(shù)秒后,自動(dòng)關(guān)閉,進(jìn)入另外的一個(gè)界面,SplashActivity跳轉(zhuǎn)到MainActivity

Android中有三種實(shí)現(xiàn)方法

xml代碼:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.example.administrator.test.SplashActivity">
  <ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/splash_iv"
    android:scaleType="fitXY"
    android:src="@mipmap/splash"/>

</RelativeLayout>

(1)利用Handler對(duì)象的postDelayed方法可以實(shí)現(xiàn),傳遞一個(gè)Runnable對(duì)象和一個(gè)需要延時(shí)的時(shí)間即可

 new Handler().postDelayed(new Runnable() {
      @Override
      public void run() {
        Intent intent=new Intent(SplashActivity.this,MainActivity.class);
        startActivity(intent);
        SplashActivity.this.finish();
      }
    },3000);

(2)使用動(dòng)畫(huà)持續(xù)時(shí)間,動(dòng)畫(huà)結(jié)束后進(jìn)行跳轉(zhuǎn)

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    iv =(ImageView)findViewById(R.id.splash_iv);
    iv.setImageResource(R.mipmap.splash);
    //設(shè)置透明度動(dòng)畫(huà)從無(wú)到有
    AlphaAnimation alphaAnimation=new AlphaAnimation(0.0f,1.0f);
    //設(shè)置動(dòng)畫(huà)持續(xù)時(shí)間
    alphaAnimation.setDuration(3000);
    //開(kāi)始顯示動(dòng)畫(huà)
    iv.startAnimation(alphaAnimation);
    //給動(dòng)畫(huà)設(shè)置監(jiān)聽(tīng),在動(dòng)畫(huà)結(jié)束的時(shí)候進(jìn)行跳轉(zhuǎn)
    alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
      @Override
      public void onAnimationStart(Animation animation) {
        //動(dòng)畫(huà)開(kāi)始時(shí)執(zhí)行
        Log.e("TAG", "onAnimationStart: " );
      }

      @Override
      public void onAnimationEnd(Animation animation) {
        //動(dòng)畫(huà)結(jié)束時(shí)執(zhí)行
        Log.e("TAG", "onAnimationEnd: " );
        Intent intent=new Intent(SplashActivity.this,MainActivity.class);
        startActivity(intent);
        finish();
      }

      @Override
      public void onAnimationRepeat(Animation animation) {
        //動(dòng)畫(huà)重復(fù)播放時(shí)執(zhí)行
        Log.e("TAG", "onAnimationRepeat: " );
      }
    });
}

(3)利用Timer定時(shí)器實(shí)現(xiàn),

 @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    iv =(ImageView)findViewById(R.id.splash_iv);
    iv.setImageResource(R.mipmap.splash);
    Timer timer=new Timer();
    timer.schedule(new TimerTask() {
      @Override
      public void run() {
        Intent intent=new Intent(SplashActivity.this,MainActivity.class);
        startActivity(intent);
        finish();
      }
    },3000);
  }

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android使用viewpager實(shí)現(xiàn)畫(huà)廊式效果

    Android使用viewpager實(shí)現(xiàn)畫(huà)廊式效果

    這篇文章主要為大家詳細(xì)介紹了Android使用viewpager實(shí)現(xiàn)畫(huà)廊式效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-08-08
  • Android自定義控件之圓形、圓角ImageView

    Android自定義控件之圓形、圓角ImageView

    這篇文章主要為大家詳細(xì)介紹了Android自定義控件之圓形、圓角ImageView的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • Android中Notification的用法匯總

    Android中Notification的用法匯總

    這篇文章主要介紹了Android中Notification的用法匯總的相關(guān)資料,需要的朋友可以參考下
    2016-01-01
  • Android實(shí)現(xiàn)單頁(yè)面浮層可拖動(dòng)view的示例代碼

    Android實(shí)現(xiàn)單頁(yè)面浮層可拖動(dòng)view的示例代碼

    本篇文章主要介紹了Android實(shí)現(xiàn)單頁(yè)面浮層可拖動(dòng)view的示例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-10-10
  • Android 畫(huà)中畫(huà)模式的實(shí)現(xiàn)示例

    Android 畫(huà)中畫(huà)模式的實(shí)現(xiàn)示例

    這篇文章主要介紹了Android 畫(huà)中畫(huà)模式的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12
  • Android Tab標(biāo)簽的使用基礎(chǔ)

    Android Tab標(biāo)簽的使用基礎(chǔ)

    Android程序中,Tab標(biāo)簽窗口是一種常用的UI界面元素。這篇文章主要介紹了Android Tab標(biāo)簽的使用基礎(chǔ),有興趣的可以了解一下。
    2016-12-12
  • 解決Android studio模擬器啟動(dòng)失敗的問(wèn)題

    解決Android studio模擬器啟動(dòng)失敗的問(wèn)題

    這篇文章主要介紹了Android studio模擬器啟動(dòng)失敗的問(wèn)題及解決方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-03-03
  • Android日期選擇控件使用詳解

    Android日期選擇控件使用詳解

    這篇文章主要為大家詳細(xì)介紹了Android日期選擇控件的使用,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-08-08
  • Android使用ViewPager完成app引導(dǎo)頁(yè)

    Android使用ViewPager完成app引導(dǎo)頁(yè)

    這篇文章主要為大家詳細(xì)介紹了Android使用ViewPager完成app引導(dǎo)頁(yè),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-11-11
  • Android 異步加載圖片分析總結(jié)

    Android 異步加載圖片分析總結(jié)

    研究了android從網(wǎng)絡(luò)上異步加載圖像,現(xiàn)總結(jié)如下,感興趣的朋友可以了解下哈
    2013-06-06

最新評(píng)論

南部县| 平湖市| 洪湖市| 许昌县| 岚皋县| 辽中县| 荥阳市| 呼图壁县| 漳浦县| 弥渡县| 栾城县| 七台河市| 湖口县| 崇义县| 松阳县| 大城县| 白玉县| 赤城县| 中宁县| 上犹县| 永宁县| 砀山县| 康保县| 自治县| 颍上县| 峡江县| 合川市| 铜梁县| 天峻县| 阜新市| 常熟市| 明光市| 万载县| 大宁县| 昂仁县| 岫岩| 洮南市| 花垣县| 徐州市| 天气| 穆棱市|