為什麼 Android 上面應用的滑動不像 iOS 那樣流暢?是因為虛擬機嗎?

假如谷歌對JAVA虛擬機進行優化的話,能不能達到IOS那樣的高度?

比如IP4和I9000


iOS 平台的滾動和其他動畫如此順滑的秘密在於:有利器 Core Animation,提供 GPU 顯示晶元硬體加速,所有的動畫只需要繪製一次然後緩存,不需要重繪,所以就會死命的快死命的快。而 Android 的動畫是 CPU 來處理,CPU 並不擅長於此,而且身兼多職十分疲累。其具備的 GPU 又一般只能用於遊戲和電影並不處理系統的過場動畫。 最近的 Android 有一些機型已經具備過場動畫硬體加速支持。但實際效果和 iOS 還有距離。跟那個叫做 Dalvik 的 JAVA 虛擬機也有一點關係。總之 Native 完勝。

---

下面是 josh a. 的文章「The Rude Awakening for iOS Devs」節錄,他的闡述非常清楚。 (josh a. 是 GitHub 員工,他開發了 GitHub for Mac. 本人非常喜歡他)

---

iOS uses animations gratuitously to great effect. They make the whole OS feel alive and physical. But the trick to animations is that they have to be fast or they ruin the whole illusion.

(That』s one of the reasons Android devices have just felt wrong up until recently. They had animations but they were slow and jerky. They didn』t make the device feel alive and physical–they made it feel slow and stodgy.)

The secret behind the smooth-as-butter animations in iOS is Core Animation. The name is a bit of a misnomer. While it does handle animation beautifully, Core Animation is actually a whole rendering system that involves much more than just animation. To completely oversimplify it, Core Animation has these things that programmers can use called CALayers. The great thing about CALayers is that they don』t have to be redrawn all the time. They can get drawn once and then cached on the GPU. This lets drawing be crazy fast, and that lets us do crazy smooth animations. Core Animation is great and it』s how all drawing on iOS happens.

(And to compare this again to Android, it was only very, very recently that Android has been able to use the GPU to render UI, and even then only on select devices and with some caveats. This is one of the reasons Android』s animations haven』t been smooth. They had to be drawn by the CPU. This meant the app and the animation had to fight for CPU cycles and the CPU had to draw UI, a task it』s not specifically suited for.)

- The Rude Awakening for iOS Devs http://d.pr/esZk


最重要的原因應該是優先順序不同。IOS注重前台操控,Android注重多任務處理。

iOS對屏幕反應的優先順序是最高的,它的響應順序依次為Touch–Media–Service–Core架構,換句話說當用戶只要觸摸接觸了屏幕之後,系統就會最優先去處理屏幕顯示也就是Touch這個層級,然後才是媒體(Media),服務(Service)以及Core架構。而Android系統的優先順序響應層級則是Application–Framework–Library–Kernal架構,和顯示相關的圖形圖像處理這一部分屬於Library,你可以看到到第三位才是它,當你觸摸屏幕之後Android系統首先會激活應用,框架然後才是屏幕最後是核心架構。

四大因素決定 淺析iOS為什麼比安卓流暢(全文)


IOS有 Core Animation,具備緩存的功能,而安卓的是靠CPU,

安卓的硬體低端的話,會卡機很嚴重。


神tm還是系統優先順序問題。 ios優先處理反饋畫面 安卓最後處理 ,聽起來很有道理 ,害我差點就信了。

真那麼簡單就一個優先處理問題 安卓會做不到嗎。


谷歌的黃油計劃已經讓4.1非常的流暢了 除非是高速相機 不然根本沒什麼區別


ios努力把動畫變的好看,安卓努力把系統負優化,android則是三好學生全方面發展


ios代表著一個廠商的一個硬體,安卓則是一群廠商一堆硬體,各個不同的廠家和各種不同的硬體對安卓的化學反應是不一樣的。


感覺言之有理啊。補充一點:

也與演算法相關吧,感覺滑動爽,也與視覺反饋有關,所以繪製時,要用人感覺最爽的方式去處理。


推薦閱讀:

開源推薦:Android圖片壓縮開源庫
如何評價一千萬台安卓手機受到廣告病毒感染?
WP 不如 Android 和 iOS 成熟,在三者高端機型都買得起的情況下你為什麼選擇 WP?
如何看待文章:讓我們準備祭奠小米帝國?
[譯] 探索 Android 大殺器——Handler

TAG:iOS | OSX開發 | Android | UIKit |