Layout Performance対決!
2012/10/04 adamrocker @CA Base Camp
Self-introduction
Masahiko Adachi@adamrocker
Engineer at BaiduGoogle Developer Expert (Android)
Android Training
http://developer.android.com/training/improving-layouts/optimizing-layout.html
実際にやってみた
LinearLayoutよりRelativeLayoutのが構造をシンプルに出来てパフォーマンスとかイイよ
Sample Layout
TL的なレイアウトを作る
入門的なLinearLayout
入門的なLinearLayout
horizontalvertical horizontal
horizontal
LinearLayout structure
一歩上のRelativeLayout
RelativeLayout
alignParentTopalignParentLeft
toRightOfalignTop
toRightOfalignTop
alignParentRightalignParentTop
belowalignLeft
belowalignLeft toRightOf
alignBottom
RelativeLayout structure
SIMPLE !
Performanceon Emulator(JB)
14.37ms 6.72ms
Performanceon Galaxy Nexus(JB)
100, 500, 1000 items
!"!!
!1,000!!
!2,000!!
!3,000!!
!4,000!!
100! 500! 1000!
Linear! Rela2ve!
12%
20%
16%
468 411
21291696
3818
3212
Summary
ニャー ニャー
・LinearLayoutは使いやすいけど程々に・RelativeLayoutで代用できる場合はコッチ・RLならレイアウトがスッキリして見やすい・RLならLLより10%~20%ぐらい高速化できる
おわりありがとうござる