<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pzling &#187; Mobile Dev</title>
	<atom:link href="http://pzling.com/category/mobile-dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://pzling.com</link>
	<description></description>
	<lastBuildDate>Sun, 08 Apr 2012 02:20:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>iphone、ipad Web开发小技巧(知识)</title>
		<link>http://pzling.com/2011/02/iphone-mobile-web-development-tips/</link>
		<comments>http://pzling.com/2011/02/iphone-mobile-web-development-tips/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 16:34:41 +0000</pubDate>
		<dc:creator>pzling</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mobile Dev]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://pzling.com/?p=550</guid>
		<description><![CDATA[iphone、ipad都水果家的，区别也不是很大(别和我提屏幕!!!)，所以放一起不作过多区分，基本都通用。资料都网上收集来的，很多我也还没条件测试，可能有些知识点已经更新了。 如何隐藏iPhone Safari的地址栏 使用meta标签，看一些资料说的，不过我在iphone4下测试没反应，不清楚iphone3是否有效或者是有什么限制。 &#60;meta name=&#34;apple-mobile-web-app-capable&#34; content=&#34;yes&#34; /&#62; 第二个方法就是通过JS处理。原理就是当我们往下滚动时，地址栏会往上收起，所以我们重围一下默认位置就可以了。也因为是使用系统自身的特性，当内容小于可视区域时(没有滚动条)，地址栏是不能隐藏的。 window.addEventListener&#40;&#34;load&#34;, function&#40;&#41; &#123; setTimeout&#40;hideURLbar, 0&#41;; &#125;, false&#41;; function hideURLbar&#40;&#41;&#123; window.scrollTo&#40;0,1&#41;; &#125; 不同的方向对应不同的样式表 &#60;link rel=&#34;stylesheet&#34; media=&#34;all and (orientation:portrait)&#34; href=&#34;portrait.css&#34;&#62; &#60;link rel=&#34;stylesheet&#34; media=&#34;all and (orientation:landscape)&#34; href=&#34;landscape.css&#34;&#62; 设置可视窗的大小 &#60;meta name=&#34;viewport&#34; content=&#34;width=device-width,minimum-scale=1.0,maximum-scale=1.0&#34;/&#62; /*width - viewport的宽度 height - viewport的高度*/ /*initial-scale - 初始的缩放比例*/ /*minimum-scale - 允许用户缩放到的最小比例*/ /*maximum-scale - 允许用户缩放到的最大比例*/ /*user-scalable - 用户是否可以手动缩放*/ [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom:20px">iphone、ipad都水果家的，区别也不是很大(别和我提屏幕!!!)，所以放一起不作过多区分，基本都通用。资料都网上收集来的，很多我也还没条件测试，可能有些知识点已经更新了。</p>
<h2>如何隐藏iPhone Safari的地址栏</h2>
<p>使用meta标签，看一些资料说的，不过我在iphone4下测试没反应，不清楚iphone3是否有效或者是有什么限制。</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-mobile-web-app-capable&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>第二个方法就是通过JS处理。原理就是当我们往下滚动时，地址栏会往上收起，所以我们重围一下默认位置就可以了。也因为是使用系统自身的特性，<strong>当内容小于可视区域时(没有滚动条)，地址栏是不能隐藏的</strong>。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> setTimeout<span style="color: #009900;">&#40;</span>hideURLbar<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> hideURLbar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
window.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>不同的方向对应不同的样式表</h2>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;all and (orientation:portrait)&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portrait.css&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;all and (orientation:landscape)&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;landscape.css&quot;</span>&gt;</span></pre></div></div>

<div class="more-wrap"><span id="more-550"></span></div>
<h2>设置可视窗的大小</h2>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;viewport&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width=device-width,minimum-scale=1.0,maximum-scale=1.0&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
/*width - viewport的宽度 height - viewport的高度*/
/*initial-scale - 初始的缩放比例*/
/*minimum-scale - 允许用户缩放到的最小比例*/
/*maximum-scale - 允许用户缩放到的最大比例*/
/*user-scalable - 用户是否可以手动缩放*/</pre></div></div>

<p>这里提一下机械人(android)家的关于user-scalable的问题，2.1有效，但2.2是无效的</p>
<h2>设置网页的桌面快捷方式图标</h2>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-touch-icon&quot;</span>  sizes<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;72x72&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-touch-icon.png&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-touch-startup-image&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;startup.png&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>第一行是设置桌面快捷方式图标的，没有sizes属性默认57*57像素的图片，圆角和高亮效果系统会自动帮你搞定，放在网页根目录会作用于下面的全部网页，当然也可以为每个页面设置单独的图标。</p>
<p>第二行是设置启动画面。</p>
<p><a href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html" title="Configuring Web Applications">相关资料</a></p>
<h2>单独给iphone设置样式</h2>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;only screen and (max-device-width: 480px)&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;iphone.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span>&gt;</span></pre></div></div>

<p><a href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html" title="Optimizing Web Content">相关资料</a></p>
<h2>特殊链接</h2>
<p>当你浏览一个有电话号码的页面时，可以直接按号码就可以打出电话，这时电话号码自动变成链接，当然它们遵循电话号码的格式，但有时你可能要手工创建一个电话号码链接，这时你可以使用tel:前缀(URI模式)，如：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tel:03545770051&quot;</span>&gt;</span>海健<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sms:03545770051&quot;</span>&gt;</span>短信<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<h2>在网页中检测屏幕的方向</h2>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">orientation</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">:</span>
    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">90</span><span style="color: #339933;">:</span>
    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">90</span><span style="color: #339933;">:</span>
    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">180</span><span style="color: #339933;">:</span>
    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>手势事件(guesture)</h2>
<p>在iPhone上，手势是两个手指的行为：缩放(放大和缩小)和旋转。iPhone支持如下几种手势事件：</p>
<ul>
<li>gesturestart</li>
<li>gestureend</li>
<li>gesturechange</li>
</ul>
<p>下面的例子中我们将监听gesturechange事件，然后使用webkitTransform样式属性缩放和旋转一个div，像往常一样，事件监听器接收event对象参数，event对象包含以下属性：</p>
<ul>
<li>event.scale ： 不缩放时值为1，缩小时值小于1，放大时值大于1</li>
<li>event.rotate ：旋转的角度</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'load'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'box'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    bstyle <span style="color: #339933;">=</span> b.<span style="color: #660066;">style</span><span style="color: #339933;">;</span>
    b.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'gesturechange'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        event.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        bstyle.<span style="color: #660066;">webkitTransform</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'scale('</span> <span style="color: #339933;">+</span> event.<span style="color: #660066;">scale</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">') '</span> <span style="color: #339933;">+</span>
        <span style="color: #3366CC;">'rotate('</span><span style="color: #339933;">+</span> event.<span style="color: #660066;">rotation</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'deg)'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>其它小知识点</h2>
<p>iphone内置了一个调试控制台；</p>
<p>每个静态资源(*.html,*.css,*.js etc) < 10M ；</p>
<p>超过25K的资源不会被缓存(gzip前)；</p>
<p>5秒钟的javascript执行时间 [<a href="http://yuiblog.com/blog/2008/02/06/iphone-cacheability/" title="Performance Research, Part 5: iPhone Cacheability – Making it Stick">更多资料</a>]</p>
</p>
<p>-webkit-text-size-adjust设置页面文字尺寸，默认为auto，建议直接设置为none；</p>
<p>-webkit-tap-highlight-color  设置手指触发链接是的颜色</p>
<p style="margin-top:30px;">更多开发资料，请查看<a href="http://developer.apple.com/" title="Apple Developer">Apple Developer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pzling.com/2011/02/iphone-mobile-web-development-tips/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>android开发环境搭建</title>
		<link>http://pzling.com/2010/03/android-environment-building/</link>
		<comments>http://pzling.com/2010/03/android-environment-building/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 13:42:30 +0000</pubDate>
		<dc:creator>pzling</dc:creator>
				<category><![CDATA[Mobile Dev]]></category>
		<category><![CDATA[android 手机]]></category>
		<category><![CDATA[android开发环境搭建]]></category>

		<guid isPermaLink="false">http://pzling.com/?p=239</guid>
		<description><![CDATA[初入门，第一步吗&#8230;&#8230;.当然是开发环境的搭建。 相关软件： JDK1.6：http://java.sun.com/javase/downloads/index.jsp Eclips3.5：http://www.eclipse.org/downloads/ Android SDK 2.1：http://developer.android.com/intl/zh-CN/index.html 首先安装JDK1.6，并配置系统环境变量。 &#8220;我的电脑&#8221;右键 &#8211; 属性 &#8211; 高级 &#8211; 环境变量 新建JAVA_HOME变量，值为JDK安装目录，默认为C:\Program Files\Java\jdk1.6.0_XX 新建CLASSPATH变量，值为 .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar 编辑Path变量，添加以下内容。 JDK  Bin目录，默认为：C:\Program Files\Java\jdk1.6.0_XX\bin abdroid的tools 目录如：F:\Soft\Mobile\android-sdk-windows\tools 紧接着是Eclips的设置。 运行Eclips,点击 &#8220;help&#8221; &#8211; &#8220;install New Software&#8221; (老版本为 &#8220;Software Updates&#8221; &#8211; &#8220;Add Site&#8221;) 在 &#8220;word with&#8221; 输入 http://dl-ssl.google.com/android/eclipse/site.xml 后点击后面的 &#8220;Add&#8221; 把可以选的都选上，一直接next 之后重启Eclips，再选择 &#8220;windows&#8221; &#8211; &#8220;Preferences&#8221;,输入Android SDK 路径，并确定。 最后就是创建AVD了，选择 &#8220;windows&#8221; &#8211; [...]]]></description>
			<content:encoded><![CDATA[<div>初入门，第一步吗&#8230;&#8230;.当然是开发环境的搭建。</div>
<div>相关软件：</div>
<ul>
<li>JDK1.6：<a href="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</a></li>
<li>Eclips3.5：<a href="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a></li>
<li>Android SDK 2.1：<a href="http://developer.android.com/intl/zh-CN/index.html">http://developer.android.com/intl/zh-CN/index.html</a></li>
</ul>
<div><strong>首先安装JDK1.6，并配置系统环境变量。</strong></div>
<ol>
<li>&#8220;我的电脑&#8221;右键 &#8211; 属性 &#8211; 高级 &#8211; 环境变量</li>
<li>新建JAVA_HOME变量，值为JDK安装目录，默认为C:\Program Files\Java\jdk1.6.0_XX</li>
<li>新建CLASSPATH变量，值为<span style="color: #99cc00;"> </span><strong>.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar</strong></li>
</ol>
<p><span style="color: #0000ff;"><img title="系统环境变量" src="http://pzling.com/wp-content/uploads/2010/03/20120301.png" alt="系统环境变量"  /> </span></p>
<ol>
<li><span>编辑Path变量，添加以下内容。<br />
JDK  Bin目录，默认为：C:\Program Files\Java\jdk1.6.0_XX\bin<br />
abdroid的tools 目录如：F:\Soft\Mobile\android-sdk-windows\tools</span></li>
</ol>
<p><span> </span></p>
<div><span><strong>紧接着是Eclips的设置。</strong></span></div>
<div><span> </span></div>
<div>运行Eclips,点击 &#8220;help&#8221; &#8211; &#8220;install New Software&#8221; (老版本为 &#8220;Software Updates&#8221; &#8211; &#8220;Add Site&#8221;)</div>
<p><span><br />
<img title="20100313-1-2" src="http://pzling.com/wp-content/uploads/2010/03/20120302.png" alt="20100313-1-2" width="326" height="287" /></span><span><br />
在 &#8220;word with&#8221; 输入 <a href="http://dl-ssl.google.com/android/eclipse/site.xml">http://dl-ssl.google.com/android/eclipse/site.xml</a> 后点击后面的 &#8220;Add&#8221;<br />
把可以选的都选上，一直接next</span></p>
<div class="more-wrap"><span id="more-239"></span></div>
<p><img title="20100313210125" src="http://pzling.com/wp-content/uploads/2010/03/20120303.png" alt="20100313210125" width="765" height="528" /></p>
<p><span>之后重启Eclips，再选择 &#8220;windows&#8221; &#8211; &#8220;Preferences&#8221;,输入Android SDK 路径，并确定。</span></p>
<p><span> </span></p>
<p><span><img title="20100313212122" src="http://pzling.com/wp-content/uploads/2010/03/20120304.png" alt="20100313212122" width="697" height="232" /></span></p>
<p><span> </span><span>最后就是创建AVD了，选择 &#8220;windows&#8221; &#8211; &#8220;Android SDK and AVD Manager&#8221;</span></p>
<p><span><img class="aligncenter size-full wp-image-245" title="20100313212820" src="http://pzling.com/wp-content/uploads/2010/03/20120305.png" alt="20100313212820" width="240" height="64" /></span></p>
<p><span><img class="aligncenter size-full wp-image-246" title="20100313213620" src="http://pzling.com/wp-content/uploads/2010/03/20120306.png" alt="20100313213620" width="749" height="595" /></span></p>
<p><span> </span></p>
<p><span>到这里环境就搭建完成了，可以开始android之旅了(新建项目里 android project 可以选择了)。</span></p>
]]></content:encoded>
			<wfw:commentRss>http://pzling.com/2010/03/android-environment-building/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

