使用Android制作一個(gè)歡迎界面?針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡(jiǎn)單易行的方法。

10余年的羅田網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。營(yíng)銷型網(wǎng)站建設(shè)的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整羅田建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“羅田網(wǎng)站設(shè)計(jì)”,“羅田網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
閃屏:在打開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)畫持續(xù)時(shí)間,動(dòng)畫結(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)畫從無(wú)到有
AlphaAnimation alphaAnimation=new AlphaAnimation(0.0f,1.0f);
//設(shè)置動(dòng)畫持續(xù)時(shí)間
alphaAnimation.setDuration(3000);
//開始顯示動(dòng)畫
iv.startAnimation(alphaAnimation);
//給動(dòng)畫設(shè)置監(jiān)聽,在動(dòng)畫結(jié)束的時(shí)候進(jìn)行跳轉(zhuǎn)
alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
//動(dòng)畫開始時(shí)執(zhí)行
Log.e("TAG", "onAnimationStart: " );
}
@Override
public void onAnimationEnd(Animation animation) {
//動(dòng)畫結(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)畫重復(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);
}關(guān)于使用Android制作一個(gè)歡迎界面問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
網(wǎng)站標(biāo)題:使用Android制作一個(gè)歡迎界面
當(dāng)前地址:http://chinadenli.net/article34/ppddpe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、網(wǎng)頁(yè)設(shè)計(jì)公司、微信小程序、網(wǎng)站導(dǎo)航、域名注冊(cè)、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
網(wǎng)頁(yè)設(shè)計(jì)公司知識(shí)