http://developer.android.com/guide/topics/ui/custom-components.html
下面的表格给出了实现一个具体View要重写的方法。
Creation |
Constructors |
There is a form of the constructor that are called when the view
is created from code and a form that is called when the view is
inflated from a layout file. The second form should parse and apply
any attributes defined in the layout file.
|
onFinishInflate()
|
Called after a view and all of its children has been inflated
from XML. |
Layout |
onMeasure(int, int)
|
Called to determine the size requirements for this view and all
of its children.
|
onLayout(boolean, int, int, int, int)
|
Called when this view should assign a size and position to all
of its children.
|
onSizeChanged(int, int, int, int)
|
Called when the size of this view has changed.
|
Drawing |
onDraw(Canvas)
|
Called when the view should render its content.
|
Event processing |
onKeyDown(int, KeyEvent)
|
Called when a new key event occurs.
|
onKeyUp(int, KeyEvent)
|
Called when a key up event occurs.
|
onTrackballEvent(MotionEvent)
|
Called when a trackball motion event occurs.
|
onTouchEvent(MotionEvent)
|
Called when a touch screen motion event occurs.
|
Focus |
onFocusChanged(boolean, int, Rect)
|
Called when the view gains or loses focus.
|
onWindowFocusChanged(boolean)
|
Called when the window containing the view gains or loses focus.
|
Attaching |
onAttachedToWindow()
|
Called when the view is attached to a window.
|
onDetachedFromWindow()
|
Called when the view is detached from its window.
|
onWindowVisibilityChanged(int)
|
Called when the visibility of the window containing the view
has changed.
|
分享到:
相关推荐
Android自定义组件开发详解
android自定义组件简单Demo
Android自定义组件开发详解,进阶书籍。本书教你如何更好使用自定义view
Android自定义组件开发详解,让你彻底理解自定义组件(自定义View、ViewGroup等,彻底了解canvas和paint的基本和高级使用方法)
《Android自定义组件开发详解》
Android自定义组件一[文].pdf
android 自定义组件android 自定义组件android 自定义组件android 自定义组件android 自定义组件android 自定义组件
Android自定义组件开发详解自制书签目录,版权属于原作者,纯制作书签方便大家使用,如有侵权联系删除
android自定义组件demo实例,里面有三种自定义组件,可以学习
6.2 自定义组件的基本结构 164 6.3 重写onMeasure方法 166 6.4 组件属性 175 6.4.1 属性的基本定义 175 6.4.2 读取来自style和theme中的属性 181 6.5 案例1:圆形ImageView组件 186 6.6 案例2:验证码组件CodeView ...
android开发中回会经常使用自定义组件,这边提供了一个非常基础的自定view动画
本文档详细讲解了Android自定义组件与特效,清晰易懂。
1) Android 自定义组件开发详解 2)view 绘图 ,界面等
Android自定义组件之日历控件-精美日历实现(内容、样式可扩展),参考博客:http://blog.csdn.net/daijin888888/article/details/47752723
Android自定义组件之自动换行View
android自定义组件可帮我们做出非常炫的手机界面
Android APIdemo中关于自定义组件的讲解,自己学习一下
一个仿Facebook和人人网的侧滑效果,详细请看:Android自定义组件系列【3】——自定义ViewGroup实现侧滑(http://blog.csdn.net/dawanganban/article/details/24007215)
Android自定义组件之日历控件-精美日历实现(内容、样式可扩展)【更新版】,参考博客:http://blog.csdn.net/daijin888888/article/details/47752723