项目结构如图:

包的分类很明确,看名字就知道意思:

net.oschina.app下面的AppStart类是程序的启动页面

应用程序启动类:显示欢迎界面并跳转到主界面

final View view = View.inflate(this, R.layout.start, null);setContentView(view);        //渐变展示启动屏AlphaAnimation aa = new AlphaAnimation(0.3f,1.0f);aa.setDuration(2000);view.startAnimation(aa);aa.setAnimationListener(new AnimationListener(){@Overridepublic void onAnimationEnd(Animation arg0) {redirectTo();}@Overridepublic void onAnimationRepeat(Animation animation) {}@Overridepublic void onAnimationStart(Animation animation) {}});

24行的inflate,是找到启动也的xml配置文件

解释:setContentView()一旦调用, layout就会立刻显示UI;而inflate只会把Layout形成一个以view类实现成的对象,有需要时再用setContentView(view)显示出来。一般在activity中通过setContentView()将界面显示出来,但是如果在非activity中如何对控件布局设置操作了,这就需要LayoutInflater动态加载。

start.xml配置文件

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:gravity="bottom"    android:background="@drawable/start_background"></LinearLayout>

在动画里启动..Main这个activity

    /**     * 跳转到...     */    private void redirectTo(){                Intent intent = new Intent(this, Main.class);        startActivity(intent);        finish();    }

更多相关文章

  1. android显示大图片的一些技巧
  2. EditText属性大全详解
  3. android minui fb显示相关函数
  4. Android(安卓)推断当前的界面是否是桌面的方法
  5. Android布局管理器-使用FrameLayout帧布局管理器显示层叠的正方
  6. 在Android(安卓)Studio 中 activity的四中启动模式
  7. Android实现3秒钟自动关闭界面
  8. android两种启动Service方式的区别
  9. Android(安卓)按钮快速点击问题的解决方案!

随机推荐

  1. MySQL修改密码的几种方式
  2. Navicat for MySQL 15注册激活详细教程
  3. MySQL 如何处理隐式默认值
  4. MySQL8.0.21安装步骤及出现问题解决方案
  5. explain命令为什么可能会修改MySQL数据
  6. mysql导入csv的4种报错的解决方法
  7. MySQL数据库重命名的快速且安全方法(3种)
  8. 解决MySQL8.0时区的问题步骤
  9. MySql8 WITH RECURSIVE递归查询父子集的
  10. 详解MySQL的sql_mode查询与设置