2、nView:contentHeight="57"mainView:refreshTime="5000"mainView:shadowHeight="30"/>main.javaTypedArraya=context.obtainStyledAttributes(attrs,R.styleable.mainView,0,0);contentW=a.getInt(R.styleable.mainView_contentWidth,0);自定义viewmain.xmlDefineview.javapublicclassDefineVi
3、ewextendsview{@overidepublicvoidondraw(Canvascavas){}}动态广告栏控件Handler的使用handler.sendMessageDelayed(handler.obtainMessage(),refreshTime);隔一段时间发个消息到达动画的效果时钟控件ListviewlistView.setOnScrollListener(newOnScrollListener(){@OverridepublicvoidonScroll(AbsListViewv,intfirstVisibleItem,intvisibleItemCou
4、nt,inttotalItemCount);@OverridepublicvoidonScrollStateChanged(AbsListViewview,intscrollState);});闪烁特效控件shader=newLinearGradient(0,0,200,0,newint[]{Color.RED,Color.GREEN,Color.BLUE},null,TileMode.MIRROR);mTxtPaint.setShader(shader);@OverrideprotectedvoidonDraw(Canvascanvas){longnow=System.cur
5、rentTimeMillis();floatelapsed=(now-lastTime)/4.5f;dx+=elapsed;Matrixmatrix=newMatrix();if(start){matrix.setTranslate(dx,0);invalidate();}else{matrix.setTranslate(0,0);}shader.setLocalMatrix(matrix);}图片浏览特效控件倒影算法通过重写Gallery的getChildStaticTransformation()实现图片间切换的效果Listview顺序移动控件mWindowManager=
6、(WindowManager)mContext.getSystemService("window");mWindowManager.addView(v,mWindowParams);privateTouchInterceptor.DragListenermDragListener=newTouchInterceptor.DragListener(){publicvoiddrag(intfrom,intto){mAdapter.notifyDataSetChanged();mListView.invalidateViews();}};更多…DockbarSlidebar….svn
7、://192.168.9.119/Android/CommonCode特效matrix.setPolyToPoly(src,0,dst,0,src.length>>1);比如伪3D立体效果canvas.drawVertices(Canvas.VertexMode.TRIANGLE_FAN,6,mVertsShadow2,0,mTexsShadow2,0,null,0,null,0,0,mPaintShadow1);比如翻书特效对特效的一些想法JNI调用.运行时执行效率高.但要注意从Java层