public class WelcomeActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_entry"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/welcomimg1"/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/welcomimg_bg"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="100dp"
android:gravity="center"
android:text="xialong"
android:textColor="@android:color/white"
android:textSize="23sp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/google_logo"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp"
android:layout_centerInParent="true"
android:tint="@android:color/white" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="@color/black"
android:endColor="@android:color/transparent"
/>
</shape>
public class WelcomeActivity extends Activity {
@Bind(R.id.iv_entry)
ImageView mIVEntry;
private static final int ANIM_TIME = 2000;
private static final float SCALE_END = 1.15F;
private static final int[] Imgs={
R.drawable.welcomimg1,R.drawable.welcomimg2,
R.drawable.welcomimg3,R.drawable.welcomimg4,
R.drawable.welcomimg5, R.drawable.welcomimg6,
R.drawable.welcomimg7,R.drawable.welcomimg8,
R.drawable.welcomimg9,R.drawable.welcomimg10,
R.drawable.welcomimg11,R.drawable.welcomimg12,};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
ButterKnife.bind(this);
Random random = new Random(SystemClock.elapsedRealtime());//SystemClock.elapsedRealtime() 从开机到现在的毫秒数(手机睡眠(sleep)的时间也包括在内)
mIVEntry.setImageResource(Imgs[random.nextInt(Imgs.length)]);
Observable.timer(1000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Long>()
{
@Override
public void call(Long aLong)
{
startAnim();
}
});
}
private void startAnim() {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(mIVEntry, "scaleX", 1f, SCALE_END);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(mIVEntry, "scaleY", 1f, SCALE_END);
AnimatorSet set = new AnimatorSet();
set.setDuration(ANIM_TIME).play(animatorX).with(animatorY);
set.start();
set.addListener(new AnimatorListenerAdapter()
{
@Override
public void onAnimationEnd(Animator animation)
{
startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
WelcomeActivity.this.finish();
}
});
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有