APP进去时的welcome界面
2016-01-14 18:42
399 查看
定义一个activity,然后推迟两秒再跳转到主activity上。
布局中:
代码:
最好是在androidMainfest配置全屏。
在activity下:
布局中:
<LinearLayout 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="zhangli.newsapp.WelcomeActivity"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/welcome"/> </LinearLayout>
代码:
package zhangli.newsapp.Activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import zhangli.newsapp.MainActivity; import zhangli.newsapp.R; public class WelcomeActivity extends Activity { private final long SPLASH_LENGTH = 2000; //导入这个包import android.os.Handler; Handler handler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome); handler.postDelayed(new Runnable() { //使用handler的postDelayed实现延时跳转 public void run() { Intent intent = new Intent(WelcomeActivity.this, MainActivity.class); startActivity(intent); finish(); } }, SPLASH_LENGTH);//2秒后跳转至应用主界面MainActivity } }
最好是在androidMainfest配置全屏。
在activity下:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
相关文章推荐
- Android中的几种Toast
- android中Baseadapter的 getItem 和 getItemId 的作用和重写
- IOS用CGContextRef画各种图形(文字、圆、直线、弧线、矩形、扇形、椭圆、三角形、圆角矩形、贝塞尔曲线、图片)
- IOS事件机制
- swift for、for-in循环
- Swift iOS项目最佳实践汇总
- IOS开发之格式化日期时间
- android状态栏颜色修改
- iOS_Swift之UICollectionView详解
- [转]iOS判断一个字符串中是否都是数字
- android允许模拟位置
- 移动端事件
- OpenGL在IOS中的应用
- Swift-04-Designated&&Convenience
- 极力推荐 自学视频java、php、python、android、objective-C教程
- ios 写项目的时候遇到的问题及解决方案(3)
- android中的Fragment
- Android状态栏颜色修改
- android控件SwipeRefreshLayout实现下拉刷新
- ios 写项目的时候遇到的问题及解决方案(2)