Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
View into the abyss
Search
Mori Masaki
February 19, 2016
Technology
390
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
View into the abyss
Mori Masaki
February 19, 2016
Other Decks in Technology
See All in Technology
Gen3R: 3D Scene Generation Meets Feed-Forward Reconstruction
spatial_ai_network
0
110
ゼロをイチにする仕事が終わったあと
smasato
0
330
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
400
オブザーバビリティ、本当に活用できてる? 〜API連携×生成AIで成熟度を自動評価〜
dmmsre
1
2.9k
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
1
4.4k
プロンプト_きのこカンファレンス2026_LT
yurufuwahealer
0
150
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
2
1.5k
AIを駆使した OSS脆弱性調査のすゝめ
saku0512
0
100
LLM/Agent評価:トップ営業の発言を「正解」にする 〜暗黙的正解による評価を営業資産に変える〜
takkuhiro
1
190
AI Driven AI Governance
pict3
0
330
Genie Ontologyは銀の弾丸かを考える / Is Genie Ontology a Silver Bullet?
nttcom
0
230
最近評価が難しくなった
maroon8021
0
330
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
800
A designer walks into a library…
pauljervisheath
211
24k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
220
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
750
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
610
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
180
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
300
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
Transcript
VIEW INTO THE ABYSS DROIDKAIGI 2016 MORI Masaki @ SmartNews
None
Supports Android 2.2~ (Froyo)
This talk also works on (almost) every Android
VIEW “A View occupies a rectangular area on the screen
and is responsible for drawing and event handling” http://developer.android.com/intl/ja/ reference/android/view/View.html
All you view is View
VIEW TREE FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button
None
3 steps to showing Views Measure - Layout - Draw
MEASURE Calculate size with requested constraint
LAYOUT Assign each position to child views
DRAW Render visual contents to Canvas
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl when setText(…)
is called
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl requestLayout requestLayout
requestLayout requestLayout View root receives requestLayout() call
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl measure, measure,
measure, measure… measure, measure measure, measure measure measure, measure Determine sizes of all Views
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl layout layout
layout layout layout Determine positions of all Views
HOW TO CUSTOM @Override void onMeasure(int widthMeasureSpec, int heightMeasureSpec) @Override
void onLayout(boolean changed, int l, int t, int r, int b) (for ViewGroup)
onMeasure: call children’s measure() and this.setMeasuredDimension() onLayout: call children’s layout()
Responsive LinearLayout
public class AdFooter extends LinearLayout { @Override protected void onMeasure(int
widthMeasureSpec, int heightMeasureSpec) { switchLayoutHorizontal(); super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (isOverflowed()) { switchLayoutVertical(); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } } Responsive LinearLayout
PERFORMANCE TIPS Avoid requestLayout() call as much as possible
removeView(oldView); addView(view, index, params); removeViewInLayout(oldView); addViewInLayout(view, index, params, true); if
(!isLayoutRequested()) { view.measure(widthMeasureSpec, heightMeasureSpec); view.layout(left, top, right, bottom); } SLOW FAST Replace child w/o layout
setImageDrawable() causes requestLayout
public class LayoutBlockingImageView extends ImageView { private boolean preventLayout; @Override
public void setImageDrawable(Drawable drawable) { preventLayout = true; super.setImageDrawable(drawable); preventLayout = false; } @Override public void requestLayout() { if (!preventLayout) super.requestLayout(); } } Needless for fixed ImageView
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl setTextColor(…) called
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl invalidate invalidate
invalidate invalidate View root receives invalidate() call
FrameLayout LinearLayout Button ImageView TextView RelativeLayout Button ViewRootImpl draw draw
draw draw draw Render visual contents to Canvas
HOW TO CUSTOM setWillNotDraw(false); @Override void onDraw(Canvas canvas)
None
leftView rightView
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
canvas.save(Canvas.CLIP_SAVE_FLAG); try { if (child == leftView) { canvas.clipRect(0, 0, splitPositionLeft, height); } else if (child == rightView) { canvas.clipRect(splitPositionRight, 0, width, height); } return super.drawChild(canvas, child, drawingTime); } finally { canvas.restore(); } } Clipping child Views
PERFORMANCE TIPS Skip heavy jobs on animation as much as
possible
Animating Stopped
Animating Stopped Kill shadows and anti-alias
Prefer invalidate(l, t, r, b)
setLayerType(LAYER_TYPE_HARDWARE) only on transition
REMEMBER Profile before Optimizing
BEST REFERENCE https://github.com/android/ platform_frameworks_base