手机卫士01-启动界面
2013-12-06 09:04
267 查看
首先,我也只是一个菜鸟来的,所以这个项目写得也很菜的,各个大神就不要喷得太厉害啦,有问题可以提出来,但因为是学习型的项目,所以不可能会像商业的项目那么的规范,和那么多的优化的。所以各位见谅啊。好了,废话不多说,直接上图
这个就是我们的程序启动时的界面,上面有个TextView显示你当前的版本,还有个ProgressBar显示正在检查更新
这两张就是我们这个项目的主界面了,你可以看到,我们要完成的一共有9个功能点,分别有:手机防盗、通讯卫士、软件管理、流量管理、任务管理、手机杀毒、系统优化、高级工具、设置中心。功能点有点多,所以代码量也有点多,但如果能够完成它,对于自己对Android的理解也会更深一点。
PS:由于我不会PhotoShop的,所以这个项目的界面就有点简单的啦,而且上面那些图标也有点与名称不相符的,各位就将就着看看,如果你有什么好的图库,不介意的话,也可以发出来,给大家共享一下,上面那些图标,也是我找了很久的,不会美工的娃,伤不起啊…
好了,由于今天是第一天,所以我们先写一下简单的,就第一张图片那里的那个程序启动界面。
首先,先在Eclipse里面新建一个新的Android项目
我的这个项目叫Security
然后呢,我新建了一个类SplashActivity
package com.xiaobin.security.ui;
import com.xiaobin.security.R;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SplashActivity extends Activity
{
private TextView tv_version;
private LinearLayout ll;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//设置不要显示标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
//设置全屏显示
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
tv_version = (TextView) findViewById(R.id.tv_splash_version);
tv_version.setText("版本号 " + getVersion());
ll = (LinearLayout) findViewById(R.id.ll_splash_main);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
alphaAnimation.setDuration(2000);
ll.startAnimation(alphaAnimation);
}
private String getVersion()
{
try
{
PackageManager packageManager = getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(getPackageName(), 0);
return packageInfo.versionName;
}
catch (NameNotFoundException e)
{
e.printStackTrace();
return "版本号未知";
}
}
}
复制代码
splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom|center_horizontal"
android:background="@drawable/logo"
android:id="@+id/ll_splash_main" >
<TextView
android:id="@+id/tv_splash_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dip"
android:textColor="#ff7fff00"
android:textSize="20sp"
android:text="@string/version"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dip"/>
</LinearLayout>
复制代码
好啦,今天的代码有点少和简单,但我们这个项目才刚开始,现在是给各个童鞋们一个缓冲,后面几节就会代码量激增的啦,现在,只要在AndroidManifest.xml里面注册一下这个Activity就可以运行一下看看效果的啦。 如果有不明白的,可以提问一下,今天的代码比较少,所以我就没怎么写注释了。下面我今天的代码的上传上来
Security_01.rar(1.76
MB, 下载次数: 1325)
这个就是我们的程序启动时的界面,上面有个TextView显示你当前的版本,还有个ProgressBar显示正在检查更新
这两张就是我们这个项目的主界面了,你可以看到,我们要完成的一共有9个功能点,分别有:手机防盗、通讯卫士、软件管理、流量管理、任务管理、手机杀毒、系统优化、高级工具、设置中心。功能点有点多,所以代码量也有点多,但如果能够完成它,对于自己对Android的理解也会更深一点。
PS:由于我不会PhotoShop的,所以这个项目的界面就有点简单的啦,而且上面那些图标也有点与名称不相符的,各位就将就着看看,如果你有什么好的图库,不介意的话,也可以发出来,给大家共享一下,上面那些图标,也是我找了很久的,不会美工的娃,伤不起啊…
好了,由于今天是第一天,所以我们先写一下简单的,就第一张图片那里的那个程序启动界面。
首先,先在Eclipse里面新建一个新的Android项目
我的这个项目叫Security
然后呢,我新建了一个类SplashActivity
package com.xiaobin.security.ui;
import com.xiaobin.security.R;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SplashActivity extends Activity
{
private TextView tv_version;
private LinearLayout ll;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//设置不要显示标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
//设置全屏显示
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
tv_version = (TextView) findViewById(R.id.tv_splash_version);
tv_version.setText("版本号 " + getVersion());
ll = (LinearLayout) findViewById(R.id.ll_splash_main);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
alphaAnimation.setDuration(2000);
ll.startAnimation(alphaAnimation);
}
private String getVersion()
{
try
{
PackageManager packageManager = getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(getPackageName(), 0);
return packageInfo.versionName;
}
catch (NameNotFoundException e)
{
e.printStackTrace();
return "版本号未知";
}
}
}
复制代码
splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom|center_horizontal"
android:background="@drawable/logo"
android:id="@+id/ll_splash_main" >
<TextView
android:id="@+id/tv_splash_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dip"
android:textColor="#ff7fff00"
android:textSize="20sp"
android:text="@string/version"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dip"/>
</LinearLayout>
复制代码
好啦,今天的代码有点少和简单,但我们这个项目才刚开始,现在是给各个童鞋们一个缓冲,后面几节就会代码量激增的啦,现在,只要在AndroidManifest.xml里面注册一下这个Activity就可以运行一下看看效果的啦。 如果有不明白的,可以提问一下,今天的代码比较少,所以我就没怎么写注释了。下面我今天的代码的上传上来
Security_01.rar(1.76
MB, 下载次数: 1325)
相关文章推荐
- 手机卫士01-启动界面
- Android项目实战--手机卫士01--启动界面
- Android项目实战--手机卫士01--启动界面 -
- Android项目实战--手机卫士01--启动界面
- 安卓开发小练手之手机卫士开发(3)——手机防盗界面的开启
- Android 手机卫士--导航界面1的布局编写
- Android项目实战--手机卫士12--手机号码归属地查询界面
- 仿腾讯手机卫士的配置动画欢迎界面
- 杀毒卫士(1)---启动界面
- 手机卫士-01
- Android手机安全卫视之启动界面
- Android 跳转手机管家的自启动界面
- 杀毒卫士(2)---启动界面帮助类
- [android] 手机卫士界面切换动画
- 安卓手机卫士开发学习第一天--Splash界面
- 手机界面_启动页
- Android 手机卫士--实现设置界面的一个条目布局结构
- 手机卫士2---splash界面的作用
- android------锁屏(手机启动出现锁屏界面)
- 安卓开发小练手之手机卫士开发(4)——手机防盗设置界面