Android中的欢迎界面实例


一般一个软件刚打开时,并不是直接就显示了程序的主界面,而是先显示欢迎界面之后停留几秒,在跳转到主界面!这样实现的效果就不再多说!!下面来看一下我项目中所用到的一个欢迎界面项目实例:

 

 

 

 

 

 

 

 

 

上述实现的代码如下:

 

MainActivity.java

 

public class MainActivity extends Activity {
	
	public void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	 
	new CountDownTimer(3000,1000) {
	 
	@Override
	public void onTick(long millisUntilFinished) {
	}
	@Override
	public void onFinish() {
	Intent intent = new Intent();
	intent.setClass(MainActivity.this, MainActivity1.class);
	startActivity(intent);
	 
	int VERSION=Integer.parseInt(android.os.Build.VERSION.SDK);
	if(VERSION >= 5){
	MainActivity.this.overridePendingTransition(R.www.alpha_in, R.www.alpha_out);
	}
	finish();
	}
	}.start();
	}
	}

 

 

activity_main.xml

 

 

<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"
    
    android:background="@drawable/t1"
     >

   
</RelativeLayout>


 


www文件夹位于res下面,www文件夹下有两个xml文件alpha_qin,alpha_out

 

alpha_in.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
 
    
    
    <alpha
        android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:duration="2000"
        
        ></alpha>
</set>

 

alpha_out.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha
        android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:duration="2000"
        
        ></alpha>

</set


 

 

 

此项目实例的代码是利用了网络上的资源!!!!!想在此分享给更多的人!!!!希望对大家有帮助!!!!

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值