Views in Android
2015-11-17 本文已影响27人
Juude
Views
ScrollView滚动到顶部
scrollTo(0, 0)
可以使用tyicoe
View的属性
- descendantFocusability
View的绘制过程
B: * 1. Draw the background
S:* 2. If necessary, save the canvas' layers to prepare for fading
C:* 3. Draw view's content //onDraw
C:* 4. Draw children//dispatchDraw
R:* 5. If necessary, draw the fading edges and restore layers
D:* 6. Draw decorations (scrollbars for instance)
- parent.draw
- parent.onDraw
- parent.dispatchDraw
- child.dispatchDraw
Canvas总结
View的measure过程
- measure(widthSpec, heightSpec)
- onMeasure
- Measure的mode
- AT_MOST
- EXACTLY
- UNSPECIFIED
- 通过
MeasureSpec.getMode
获得
View的layout
过程
- generateLayoutParams
- checkLayoutParams
横竖屏切换View的改变
- 有这句话:
android:configChanges="orientation|screenSize|keyboardHidden"
,横竖屏切换不会重新调用生命周期