2011年06月29日
by 江小邪
0 comments
1、制作一张启动图片splash.png,放置在res->drawable-hdpi文件夹中。
2、新建布局文件splash.xml
<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”fill_parent” android:layout_height=”fill_parent”
android:gravity=”bottom|center” android:orientation=”vertical”
android:background=”@drawable/splash”>
<TextView android:text=”@+id/TextView01″ android:layout_width=”wrap_content”
android:layout_height=”wrap_content” android:layout_marginTop=”20dip”
android:typeface=”sans” android:shadowDx=”0″ android:shadowDy=”2″
android:shadowRadius=”1″ android:shadowColor=”#FFFFFF”
android:textColor=”#444444″ android:textSize=”20dip” android:id=”@+id/versionNumber”
android:gravity=”bottom”>
</TextView>
</LinearLayout>
这里我们把上一步制作的图片作为启动界面的背景图,然后在界面底部显示当前程序的版本号。
3、新建SplashActivity,在Oncreate中添加以下代码:
setContentView(R.layout.splash);
PackageManager pm = getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo(“com.lyt.android”, 0);
TextView versionNumber = (TextView) findViewById(R.id.versionNumber);
versionNumber.setText(“Version ” + pi.versionName);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this,SplashScreenActivity.class);
startActivity(intent);
SplashActivity.this.finish();
}
}, 2500);
4、 修改Manifest文件,将启动界面Activity改为默认启动,并且设置标题栏不可见。
<?xml version=”1.0″ encoding=”utf-8″?>
<manifest xmlns:android=”http://schemas.android.com/apk/res/android”
package=”com.lyt.android” android:versionCode=”1″ android:versionName=”1.0″>
<application android:icon=”@drawable/icon” android:label=”@string/app_name”>
<activity android:name=”.SplashActivity” android:label=”@string/app_name”
android:theme=”@android:style/Theme.NoTitleBar”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
<activity android:name=”.SplashScreenActivity” android:label=”@string/app_name” >
</activity>
</application>
<uses-sdk android:minSdkVersion=”8″ />
</manifest>
5、显示效果如下:

标签Tags:
Android笔记,
class,
code,
div,
ie,
title,
xml,
代码,
图片,
版本,
程序
Android笔记
2011年06月29日
by 江小邪
0 comments
Android的ROM中有很多odex文件,相对于APK中的dex文件而言这个odex有什么作用呢? 如果你仔细观察会发现文件名时一一对应的,同时那些对应的apk文件中没有dex文件。这样做可以使其厂商保证一定的反盗版,因为没有没有dex文件的apk是无法正常安装的,而厂商直接将odex和不完整的apk文件放到手机rom固化到/system/bin中可以让一般用户无法正常导出使用
可能想到的是合并odex和apk变成apk中包含dex文件的,这样合并后最终apk文件安装在/data/中,而rom存放在 /system/app中,所以最终导致了用户可装在Android手机中的软件会变少,占用系统空间。 (更多…)
标签Tags:
Android笔记,
class,
code,
google,
方法,
类,
系统,
软件
Android笔记
2010年05月23日
by 江小邪
1 comment
<?php
# $Id: js.class.php,v 0.1 p $
// 禁止直接访问该页面
if (basename($HTTP_SERVER_VARS['PHP_SELF']) == "js.class.php") {
header("HTTP/1.0 404 Not Found");
}
# Purpose 封装了一些常用的Javascript代码,以便在PHP中快速调用
class JS{
function JS(){}
#返回上页
# @param $step 返回的层数 默认为1
function Back($step = -1){
$msg = "history.go(".$step.");";
JS::_Write($msg);
JS::FreeResource();
exit;
}
# 弹出警告的窗口
# @param $msg 警告信息
function Alert($msg){
$msg = "alert(\"".$msg."\");";
JS::_Write($msg);
}
# 写js
# @param $msg
function _Write($msg) {
echo "<script language=\"javascript\">\n";
echo $msg;
echo "\n</SCRIPT>";
}
# 刷新当前页
function Reload(){
$msg = "location.reload();";
JS::FreeResource();
JS::_Write($msg);
exit;
}
#刷新弹出父页
function ReloadOpener(){
$msg = "if (opener) opener.location.reload();";
JS::_Write($msg);
}
#跳转到url
#@param $url 目标页
function Goto($url){
$msg = "location.href = ‘$url’;";
JS::FreeResource();
JS::_Write($msg);
exit;
}
#关闭窗口
function Close(){
$msg = "window.close()";
JS::FreeResource();
JS::_Write($msg);
exit;
}
#提交表单
#@param $frm 表单名
function Submit($frm){
$msg = $frm.".submit();";
JS::_Write($msg);
}
#关闭数据库连接
function FreeResource(){
// 数据库连接标志
global $conn;
if (is_resource($conn))
@mysql_close($conn);
}
}
?>
标签Tags:
class,
javascript,
JavaScript&Ajax,
js,
mysql,
PHP,
PHP,
server,
sql,
url,
代码,
常用,
提交表单,
数据,
数据库,
类,
网络编程,
表,
表单,
连接,
页面
JavaScript&Ajax, PHP, 网络编程
2010年05月23日
by 江小邪
2 comments
<html>
<head><title>新闻图片轮换类</title>
<script type=”text/javascript”>
var fs = new FadeSlideClass();
fs.Width = 430;
fs.Height = 250;
fs.AddImage(“http://www.5bay.cn/Test/Image/001.jpg“, “#”, “新闻标题”);
fs.AddImage(“http://www.5bay.cn/Test/Image/002.jpg“, “#”, “新闻标题”);
fs.AddImage(“http://www.5bay.cn/Test/Image/003.jpg“, “//g.cn”, “去Google”);
fs.AddImage(“http://www.5bay.cn/Test/Image/004.jpg“, “#”, “新闻标题”);
fs.AddImage(“http://www.5bay.cn/Test/Image/005.jpg“, “#”, “新闻标题”);
fs.RenderTo(“divStage”);
/* 以下代码构造轮换类 */
function FadeSlideClass()
{
this.Width = 450;
this.Height = 300;
this.BorderColor = “#ddd”;
this.CurrentColor = “green”;
this.Delay = 5000;
var divContainer = document.createElement(“div”);
var divImage = document.createElement(“div”);
var ulList = document.createElement(“ul”);
var me = this;
var arrImg = new Array;
this.Tag = divContainer;
this.AddImage = function(strImageUrl, strLink, strTitle)
{
arrImg.push(arguments);
}
this.RenderTo = function(container)
{
if(typeof container == “string”) container = document.getElementById(container) || container;
if(typeof container == “string”) return setTimeout(function(){ me.RenderTo(container); }, 100);
if(!arrImg.length) throw new Error(“尚未添加图片。”);
var cssFloat = typeof ulList.style.cssFloat == “string” ? “cssFloat” : “styleFloat”;
divContainer.style.width = this.Width + “px”;
divContainer.style.height = this.Height + “px”;
divImage.style.width = Math.round(this.Width * (arrImg.length – 1) / arrImg.length) + “px”;
divImage.style.height = this.Height + “px”;
divImage.style[cssFloat] = “left”;
ulList.style.width = (this.Width – parseInt(divImage.style.width)) + “px”;
ulList.style.height = this.Height + “px”;
ulList.style.margin = “0px”;
ulList.style.padding = “0px”;
ulList.style[cssFloat] = “left”;
divContainer.style.overflow = “hidden”;
divImage.style.overflow = “hidden”;
ulList.onmouseover = function(){ clearTimeout(me.Handler) };
ulList.onmouseout = function(){ AutoPlay(); };
InitImage(2);
InitList(arrImg.length);
container.appendChild(divContainer);
divContainer.appendChild(divImage);
divContainer.appendChild(ulList);
LiMouseOver.call(ulList.firstChild);
AutoPlay();
this.AddImage = function(){ throw new Error(“该方法已过时。”); }
}
this.Display = function(imgThumb)
{
var img = divImage.lastChild.lastChild;
var opa = new OpacityClass(img);
opa.Set(20);
img.src = imgThumb.src;
img.parentNode.href = imgThumb.parentNode.href;
img.parentNode.title = imgThumb.parentNode.title;
clearInterval(ulList.Handler);
ulList.Handler = setInterval(function(){
if(opa.Add(5) >= 100)
{
divImage.firstChild.lastChild.src = img.src;
clearInterval(ulList.Handler);
}
}, 25);
}
function LiMouseOver()
{
if(this == ulList.oldLi) return;
if(ulList.oldLi) ulList.oldLi.style.borderColor = me.BorderColor;
this.style.borderColor = me.CurrentColor;
ulList.oldLi = this;
me.Display(this.firstChild.firstChild);
}
function InitImage(count)
{
if(–count) arguments.callee(count);
var a = document.createElement(“a”);
a.target = “_blank”;
divImage.appendChild(a).style.position = “absolute”;
var img = new Image;
img.width = parseInt(divImage.style.width);
img.height = me.Height;
img.border = 0;
if(!a.appendChild(img).filters) img.style.opacity = 1;
else img.style.filter = “alpha(opacity=100)”;
}
function InitList(count)
{
if(–count) InitList(count);
var isIeNoDtd = document.compatMode != “CSS1Compat” && /msie/i.test(navigator.userAgent);
var data = arrImg[count];
var thumbWidth = parseInt(ulList.style.width);
var thumbHeight = Math.round(me.Height / arrImg.length);
var li = document.createElement(“li”);
li.style.overflow = “hidden”;
li.style.width = (isIeNoDtd ? thumbWidth : thumbWidth – 4) + “px”;
li.style.height = (isIeNoDtd ? thumbHeight : thumbHeight – 4) + “px”;
li.style.borderWidth = “2px”;
li.style.borderStyle = “solid”;
li.style.borderColor = me.BorderColor;
var a = document.createElement(“a”);
a.target = “_target”;
a.href = data[1];
a.title = data[2];
var img = new Image;
img.border = 0;
img.width = thumbWidth;
img.height = thumbHeight;
img.src = data[0];
img.style.verticalAlign = “top”;
img.style.margin = “-2px”;
a.appendChild(img);
li.appendChild(a);
li.style.listStyle = “none”;
li.onmouseover = LiMouseOver;
ulList.appendChild(li);
}
function AutoPlay()
{
me.Handler = setTimeout(function()
{
LiMouseOver.call(ulList.oldLi.nextSibling || ulList.firstChild);
AutoPlay();
}, me.Delay);
}
function OpacityClass(tag)
{
var isFilter = !!tag.filters;
var obj = isFilter ? tag.filters.alpha : tag.style;
this.Set = function(value)
{
obj.opacity = isFilter ? value : value / 100;
return this;
}
this.Add = function(value)
{
var opa = isFilter ? obj.opacity : obj.opacity * 100;
opa += value;
if(opa > 100) opa = 100;
obj.opacity = isFilter ? opa : opa / 100;
return this;
}
this.valueOf = function()
{
return isFilter ? obj.opacity : obj.opacity * 100;
}
}
}
</script>
</head>
<body>
<div id=”divStage”></div>
</body>
</html>
标签Tags:
class,
css,
div,
google,
html,
ie,
javascript,
JavaScript&Ajax,
mod,
seo,
title,
url,
代码,
图片,
方法,
类,
网络编程
JavaScript&Ajax, 网络编程
2010年05月23日
by 江小邪
0 comments
/usr/local/bin/memcached -d -m 10 -u root -l 127.0.0.1 -p 11211 -c 256 -P /tmp/memcached.pid
memcached 的服务正式启动
Memcache::add — 添加一个值,如果已经存在,则返回false
Memcache::addServer — 添加一个可供使用的服务器地址
Memcache::close — 关闭一个Memcache对象
Memcache::connect — 创建一个Memcache对象
memcache_debug — 控制调试功能
Memcache::decrement — 对保存的某个key中的值进行减法操作
Memcache::delete — 删除一个key值
Memcache::flush — 清除所有缓存的数据
Memcache::get — 获取一个key值
Memcache::getExtendedStats — 获取进程池中所有进程的运行系统统计
Memcache::getServerStatus — 获取运行服务器的参数
Memcache::getStats — 返回服务器的一些运行统计信息
Memcache::getVersion — 返回运行的Memcache的版本信息
Memcache::increment — 对保存的某个key中的值进行加法操作
Memcache::pconnect — 创建一个Memcache的持久连接对象
Memcache::replace — R对一个已有的key进行覆写操作
Memcache::set — 添加一个值,如果已经存在,则覆写
Memcache::setCompressThreshold — 对大于某一大小的数据进行压缩
Memcache::setServerParams — 在运行时修改服务器的参数 (更多…)
标签Tags:
cache,
class,
div,
ie,
PHP,
PHP,
server,
status,
函数,
区别,
对象,
数据,
方法,
版本,
类,
系统,
网络编程,
获取,
表,
连接,
错误
PHP, 网络编程
2006年10月27日
by 江小邪
0 comments
作用:取得随机字符串
参数:
1、(int)$length = 32 #随机字符长度
2、(int)$mode = 0 #随机字符类型,0为大小写英文和数字,1为数字,2为小写子木,3为大写字母,4为大小写字母,5为大写字母和数字,6为小写字母和数字
返回:取得的字符串 (更多…)
标签Tags:
class,
PHP,
PHP,
随机数
PHP
2006年10月27日
by 江小邪
0 comments
PHP–下面这个类的功能则很强大,不但能发html格式的邮件,还可以发附件
(更多…)
标签Tags:
class,
PHP,
PHP,
类,
邮件
PHP
2006年03月23日
by 江小邪
0 comments

按Ctrl+a
标签Tags:
class,
邪人邪语
邪人邪语