• android,view的执行过程onDraw、onSizeChanged,onFinishInflate


    android,view的执行过程onDraw、onSizeChanged,onFinishInflate - 夏天的风的日志 - 网易博客

    小试view的执行过程,此是入门,高手绕道。

     

    --------------------------------------------------------------------------------

    此为抛砖引玉,个人看官自己发挥。

    结果如下:

    12-05 22:23:03.587: D/mDebug(9715): TestView context, attrs=@2131034112

    12-05 22:23:03.597: D/mDebug(9715): onFinishInflate

    12-05 22:23:03.667: D/mDebug(9715): onSizeChanged,w=240,h=282,oldw=0,oldh=0

    12-05 22:23:03.727: D/mDebug(9715): onDraw

    12-05 22:23:03.757: D/mDebug(9715): onDraw

     

     

     

    public class TestView extends View {

     

             public TestView(Context context) {

                       super(context);

                       Log.d("mDebug", "TestView context");

             }


             public TestView(Context context, AttributeSet attrs, int defStyle) {

                       super(context, attrs, defStyle);

                       Log.d("mDebug", "TestView context,attrs,defStyle attrs="+attrs.getAttributeValue(0));

             }

     

             public TestView(Context context, AttributeSet attrs) {

                       super(context, attrs);

                       Log.d("mDebug", "TestView context, attrs="+attrs.getAttributeValue(0));

             }

             @Override

             protected void onDraw(Canvas canvas) {

                       // TODO Auto-generated method stub

                       super.onDraw(canvas);

                       Log.d("mDebug", "onDraw");

             }

     

             @Override

             protected void onFinishInflate() {

                       // TODO Auto-generated method stub

                       super.onFinishInflate();

                       Log.d("mDebug", "onFinishInflate");

             }

     

             @Override

             protected void onSizeChanged(int w, int h, int oldw, int oldh) {

                       // TODO Auto-generated method stub

                       super.onSizeChanged(w, h, oldw, oldh);

                       Log.d("mDebug", "onSizeChanged,w="+w+",h="+h+",oldw="+oldw+",oldh="+oldh);

             }

    }

    android,view的执行过程onDraw、onSizeChanged,onFinishInflate - 夏天的风的日志 - 网易博客

    小试view的执行过程,此是入门,高手绕道。

     

    --------------------------------------------------------------------------------

    此为抛砖引玉,个人看官自己发挥。

    结果如下:

    12-05 22:23:03.587: D/mDebug(9715): TestView context, attrs=@2131034112

    12-05 22:23:03.597: D/mDebug(9715): onFinishInflate

    12-05 22:23:03.667: D/mDebug(9715): onSizeChanged,w=240,h=282,oldw=0,oldh=0

    12-05 22:23:03.727: D/mDebug(9715): onDraw

    12-05 22:23:03.757: D/mDebug(9715): onDraw

     

     

     

    public class TestView extends View {

     

             public TestView(Context context) {

                       super(context);

                       Log.d("mDebug", "TestView context");

             }


             public TestView(Context context, AttributeSet attrs, int defStyle) {

                       super(context, attrs, defStyle);

                       Log.d("mDebug", "TestView context,attrs,defStyle attrs="+attrs.getAttributeValue(0));

             }

     

             public TestView(Context context, AttributeSet attrs) {

                       super(context, attrs);

                       Log.d("mDebug", "TestView context, attrs="+attrs.getAttributeValue(0));

             }

             @Override

             protected void onDraw(Canvas canvas) {

                       // TODO Auto-generated method stub

                       super.onDraw(canvas);

                       Log.d("mDebug", "onDraw");

             }

     

             @Override

             protected void onFinishInflate() {

                       // TODO Auto-generated method stub

                       super.onFinishInflate();

                       Log.d("mDebug", "onFinishInflate");

             }

     

             @Override

             protected void onSizeChanged(int w, int h, int oldw, int oldh) {

                       // TODO Auto-generated method stub

                       super.onSizeChanged(w, h, oldw, oldh);

                       Log.d("mDebug", "onSizeChanged,w="+w+",h="+h+",oldw="+oldw+",oldh="+oldh);

             }

    }

  • 相关阅读:
    getWritableDatabase()与getReadableDatabase()方法
    使用drawBitmapMesh扭曲图像
    移动游戏背景
    使用Matrix控制图片和组件的变化
    使用Matrix控制图像或组件变换的步骤
    1105: 零起点学算法12——求2个日期之间的天数
    1104: 零起点学算法11——求梯形面积
    1103: 零起点学算法10——求圆柱体的表面积
    1102: 零起点学算法09——继续练习简单的输入和计算(a-b)
    1101: 零起点学算法08——简单的输入和计算(a+b)
  • 原文地址:https://www.cnblogs.com/seven1979/p/4369431.html
Copyright © 2020-2023  润新知