【手机安全卫士01】项目Splash页面的开发与设计
首先建立一个安卓的项目,然后修改manifest.xml文件,修改应用程序的logo和显示名称,效果图如下:

对应的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lq.wangzhen.mobilesafe"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="@drawable/callmsgsafe" //设置应用程序的logo
android:label="@string/app_name" //设置应用程序的名称
android:theme="@style/AppTheme" >
<activity
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:name="lq.wangzhen.mobilesafe.SplashActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
使用到的strings.xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<resources> <string name="app_name">手机卫士</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string> </resources>
更改完成应用程序的图片以后,下面开始编写应用程序的启动界面,界面的效果图如下:

这里我们包含了一下的几个信息:
- 当前应用程序的版本号;
- 启动时的一个ProgressBar;
- 背景图片
- 设置显示为全屏幕显示,没有标题栏和状态栏
建立一个SplashActivity,对应的布局文件为:activity_splash.xml文件,然后在manifest.xml文件中配置当前的Acitivity,代码如下:
<activity
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" //配置当前的Activity是全屏显示的
android:name="lq.wangzhen.mobilesafe.SplashActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> //配置当前的Activity是应用程序的启动页面 <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
编辑完成以后,完成activity_spalsh.xml文件,完成Spash页面的布局:
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".SplashActivity"
android:background="@drawable/logo2" > //配置当前Activity的背景图片 <TextView //显示当前应用程序的版本号
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_splash_version"
android:text="版本号:"
android:layout_alignParentRight="true"
android:textColor="#FF0000"
android:textSize="20sp"/> <ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="130dp"/> </RelativeLayout>
然后在SpalshActivity类中加载以上的activity_splash.xml布局文件,然后运行程序即得到以上的效果图。
package lq.wangzhen.mobilesafe; import android.os.Bundle;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.view.Menu;
import android.widget.TextView; public class SplashActivity extends Activity {
private TextView tv_splash_version;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
this.tv_splash_version = (TextView) this.findViewById(R.id.tv_splash_version);
this.tv_splash_version.setText("版本号:"+getVersion()); //设置应用程序的版本号
}
/**
* 取得应用的版本号
* @return
*/
public String getVersion(){
PackageManager pm = getPackageManager(); //取得包管理器的对象,这样就可以拿到应用程序的管理对象
try {
PackageInfo info = pm.getPackageInfo(getPackageName(), 0); //得到应用程序的包信息对象
return info.versionName; //取得应用程序的版本号
} catch (NameNotFoundException e) {
e.printStackTrace();
//此异常不会发生
return "";
}
}
}
【手机安全卫士01】项目Splash页面的开发与设计的更多相关文章
- 项目Splash页面的开发与设计
项目Splash页面的开发与设计 首先建立一个安卓的项目,然后修改manifest.xml文件,修改应用程序的logo和显示名称,效果图如下: 对应的代码如下: 1 <?xml version= ...
- Android 手机卫士1--实现splash页面
1.minSdkVersion.targetSdkVersion.maxSdkVersion.target API level四个数值到底有什么区别? minSdkVersion, maxSdkVer ...
- ThinkPHP6.0学习之项目安装页面的开发
在我们做一个项目的时候,如果是自己用或者是给同行用的话往往不需要做一个安装页面的,但是如果是将项目给一些不怎么会操作服务器,不怎么会程序的人用的时候,我们就需要一个安装页面来帮助他们更好的将项目安装好 ...
- Android 项目实战--手机卫士(实现splash)
从今天开始根据之前学习的android的基础知识,实战一下,实现一个简单功能的android手机卫士 本文地址:http://www.cnblogs.com/wuyudong/p/5899283.ht ...
- 【vue】饿了么项目-页面骨架开发
1.页面骨架开发 1.1组件拆分 手机浏览器是把页面放在一个虚拟的“窗口”(viewport)中,通常这个虚拟的“窗口”(viewport)比屏幕宽,这样就不用把每个网页挤到很小的窗口中(这样会破坏没 ...
- Android快乐贪吃蛇游戏实战项目开发教程-01项目概述与目录
一.项目简介 贪吃蛇是一个很经典的游戏,也很适合用来学习.本教程将和大家一起做一个Android版的贪吃蛇游戏. 我已经将做好的案例上传到了应用宝,无病毒.无广告,大家可以放心下载下来把玩一下.应用宝 ...
- Android项目 手机安全卫士(代码最全,注释最详细)之十二 设置中心的界面
------- 源自梦想.永远是你IT事业的好友.只是勇敢地说出我学到! ---------- 按惯例,写在前面的:可能在学习Android的过程中,大家会和我一样,学习过大量的基础知识,很多的知识点 ...
- Android项目实战_手机安全卫士home界面
# 安全卫士主页面# ###1.GridView控件 1.与ListView的使用方式差不多,也要使用数据适配器,通过设置android:numColumns控制显示几列 2.通过指定android: ...
- H5类似易企秀/编辑器/页面制作/开发/生成工具/软件/源码/授权
代码地址如下:http://www.demodashi.com/demo/14960.html 项目简介 H5DS (HTML5 Design software) 这是一款基于WEB的 H5制作工具. ...
随机推荐
- 【Java每日一题】20170109
20170106问题解析请点击今日问题下方的"[Java每日一题]20170109"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...
- ubuntu firefox 选中变成了删除
在ubuntu下 我的firefox浏览器出现了问题.描述: 1.在firefox中所有能够删除的文字只要选中就自动删除了. 终端中 ibus-setup勾掉在应用窗口中启用内嵌编辑模式
- 通过cocos2d-x的CCGLProgram和CCShaderCache的实现来分析OpenGL ES中的Shader编程
在OpenGL ES中,Shader是着色器,包括两种:顶点着色器(Vertex Shader)和片元着色器(Fragment Shader).每个program对象有且仅有一个Vertex Shad ...
- 搭建自己的SIPserver:开源sipserveropensips的搭建及终端TwInkle的使用
先下载源代码: 这里我下载的是1.8.2,由于这个是眼下的最稳定版本号,(尽管已经有1.9及2.0了) http://opensips.org/pub/opensips/1.8.2/src/opens ...
- iOS UI布局调试工具
查看ios软件的ui布局有三种: 1.DCIntrospect 这种方式是开源的,我从github上clone下来后运行demo,运行遇到了问题:Xcode cannot run using t ...
- Log4j使用教程 (转载http://www.codeceo.com/article/log4j-usage.html)
日志是应用软件中不可缺少的部分,Apache的开源项目log4j是一个功能强大的日志组件,提供方便的日志记录.在apache网站:jakarta.apache.org/log4j 可以免费下载到Log ...
- composer 说明<转>
转自 http://blog.csdn.net/zzulp/article/details/18981029 Composer是一个基于项目的依赖管理器,负责将PHP项目所依赖的包或库安装到项目所在 ...
- Android客户端与服务端交互之登陆示例
Android客户端与服务端交互之登陆示例 今天了解了一下android客户端与服务端是怎样交互的,发现其实跟web有点类似吧,然后网上找了大神的登陆示例,是基于IntentService的 1.后台 ...
- 在ASP.NET将程序中将上传的附件存储到另一台文件服务器上的实现
假定有两台服务器:A和B,其中A为Web服务器(IP:192.123.1.1, 为iis发布程序的服务器 ),B为文件服务器(IP: 192.123.2.2) 在文件服务器B中某个磁盘下创建一个共享文 ...
- angular-ui-tree
angular-ui-tree的github项目地址:https://github.com/angular-ui-tree/angular-ui-tree DEMO目录结构如下: bootstrap. ...