美文网首页
Views in Android

Views in Android

作者: Juude | 来源:发表于2015-11-17 15:53 被阅读27次

    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",横竖屏切换不会重新调用生命周期

    自定义View

    TransformationInfo

    相关文章

      网友评论

          本文标题:Views in Android

          本文链接:https://www.haomeiwen.com/subject/koakhttx.html