Android什么时候ondraw流程,android,view的实施过程onDraw、onSizeChanged,onFinishInflate...

你是否正在寻找关于onfinishinflate的内容?让我把最完整的东西奉献给你:

当前位置:我的异常网» Android»android,view的实施过程onDraw、onSizeChanged,on

android,view的实施过程onDraw、onSizeChanged,onfinishinflate

网友分享于:2013-07-03浏览:1098次

android,view的执行过程onDraw、onSizeChanged,onfinishinflate

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

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

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

结果如下:

12-05 22:23:03.587: D/mDebug(9715): TestView context, [emailprotected]

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

[size=l代码如下:[/size]

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);

}

}

问题: 构造函数的context为何物,attrs从何处来

看到这篇文章貌似解决了以上问题。

扩展地址:

以上就是关于onfinishinflate的全部内容,相信你一定会非常满意。

本文来自电脑杂谈,转载请注明本文网址:

http://www.pc-fly.com/a/jisuanjixue/article-4742-1.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值