android view构造函数研究】的更多相关文章

       上周遇到了SurfaceView的constructor的问题,周末决定略微细致地研究一下这个令人发指的玩意.   SurfaceView是View的子类,与View一样有三个constructor:   1 public void CustomView(Context context) {}2 public void CustomView(Context context, AttributeSet attrs) {}3 public void CustomView(Context…
2015-07-28 17:29:19 这一篇主要看看布局过程 一.布局过程肯定要不可避免的涉及到layout()和onLayout()方法,这两个方法都是定义在View.java中,源码如下: /** * Assign a size and position to a view and all of its * descendants * * <p>This is the second phase of the layout mechanism. * (The first is measur…
自己定义一个view <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" androi…
2015-07-28 17:23:20 本篇是关于LayoutParams相关 ViewGroup.LayoutParams文档解释如下: LayoutParams are used by views to tell their parents how they want to be laid out. See ViewGroup Layout Attributes for a list of all child view attributes that this class supports.…
2015-07-27 16:52:58 一.如何通过继承ViewGroup来实现自定义View?首先得搞清楚Android时如何绘制View的,参考Android官方文档:How Android Draws Views 以下翻译摘自:http://blog.csdn.net/linghu_java/article/details/23882681,这也是一片好文章,推荐大家看看- When an Activity receives focus, it will be requested to d…
本文结合一些周知的概念和源码片段,对View动画的工作原理进行挖掘和分析.以下不是对源码一丝不苟的分析过程,只是以搞清楚Animation的执行过程.如何被周期性调用为目标粗略分析下相关方法的执行细节,最终贯穿View动画实际发生的一切. View动画使用 Android提供了属性动画(property animation).帧动画(frame-by-frame animation)和View动画( tweened animation:补间动画),View动画的使用相对简单,但又不像真正意义上的…
一直想写事件分发机制的文章,不管咋样,也得自己研究下事件分发的源码,写出心得~ 首先我们先写个简单的例子来测试View的事件转发的流程~ 1.案例 为了更好的研究View的事件转发,我们自定以一个MyButton继承Button,然后把跟事件传播有关的方法进行复写,然后添加上日志~ MyButton package com.example.zhy_event03; import android.content.Context; import android.util.AttributeSet;…
========= 5.0     android异常“android.view.InflateException: Binary XML file line # : Error inflating class” 今天用到viewPager写了个小demo测试FragmentStatePagerAdapter和FragmentPagerAdapter的区别,忽然报出了“android.view.InflateException: Binary XML file line # : Error in…
作为自定义 view 的基础,如果不了解android  view 的生命周期 , 那么你将会在后期的维护中发现这样那样的问题 ....... 做过一段时间android 开发的同学都知道,一般 onXXX 函数都是系统的回调函数.而这篇 blog 也是基于这个思想(或许有点笨)......   首先来看三分  创建view 的 日志信息 (自定义View 配置到xml文件中): android:visibility=gone 03-25 19:56:55.934: D/yyyyy(11493)…
 前p=1959">Android物业动画研究(Property Animation)全然解析具体解释上已经基本展示了属性动画的核心使用方法: ObjectAnimator实现动画,ValueAnimator实现动画,AnimatorSet的使用等~ 当然了属性动画另一部分的知识点,也能做出非常不错的效果,将在本篇博客为您展示~ 1.怎样使用xml文件来创建属性动画 大家肯定都清楚,View Animator .Drawable Animator都能够在anim目录下创建动画,然后在程…