android-8 /** * Pass the touch screen motion event down to the target view, or this * view if it is the target. * * @param event The motion event to be dispatched. * @return True if the event was handled by the view, false otherwise. */ public boolea
public class View implements Drawable.Callback, KeyEvent.Callback, AccessibilityEventSource { /** * Pass the touch screen motion event down to the target view, or this * view if it is the target. * * @param event The motion event to be dispatched. *
View是所有控件的一个基类,无论是布局(Layout),还是控件(Widget)都是继承自View类.只不过layout是一个特殊的view,它里面创建一个view的数组可以包含其他的view而已. 这一篇文章把所有的layout和widget都统称为view,那么android是如何创建一个view的呢? 一.在代码中直接new出来. 比如说你要创建一个TextView的实例,那么你可以这样写: TextView text = new TextView(c); //c为context对象,
invalidate方法源码分析 在之前分析View的绘制流程中,最后都有调用一个叫invalidate的方法,这个方法是啥玩意?我们来看一下View类中invalidate系列方法的源码(ViewGroup没有重写这些方法),如下: /** * Mark the area defined by dirty as needing to be drawn. dirty代表需要重新绘制的脏的区域 * , 0, mRight - mLeft, mBottom - mTop, invalidateC