2、inView: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.javapublicclassDefineViewextendsview{@overidepublicvoidon
3、draw(Canvascavas){}}動態(tài)廣告欄控件Handler的使用handler.sendMessageDelayed(handler.obtainMessage(),refreshTime);隔一段時間發(fā)個消息到達動畫的效果時鐘控件ListviewlistView.setOnScrollListener(newOnScrollListener(){@OverridepublicvoidonScroll(AbsListViewv,intfirstVisibleItem,intvisibleItemCount,inttotalItemCount);@Overridepublicvoido
4、nScrollStateChanged(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.currentTimeMillis();floatelapsed=(now-lastTime)/4.5f;
5、dx+=elapsed;Matrixmatrix=newMatrix();if(start){matrix.setTranslate(dx,0);invalidate();}else{matrix.setTranslate(0,0);}shader.setLocalMatrix(matrix);}圖片瀏覽特效控件倒影算法通過重寫Gallery的getChildStaticTransformation()實現(xiàn)圖片間切換的效果Listview順序移動控件mWindowManager=(WindowManager)mContext.getSystemService("window");mWindow
6、Manager.addView(v,mWindowParams);privateTouchInterceptor.DragListenermDragListener=newTouchInterceptor.DragListener(){publicvoiddrag(intfrom,intto){mAdapter.notifyDataSetChanged();mListView.invalidateViews();}};更多…DockbarSlidebar….svn://192.168.9.119/Android/CommonCode特效matrix.setPolyToPoly(src,0,ds
7、t,0,src.length>>1);比如偽3D立體效果canvas.drawVertices(Canvas.VertexMode.TRIANGLE_FAN,6,mVertsShadow2,0,mTexsShadow2,0,null,0,null,0,0,mPaintShadow1);比如翻書特效對特效的一些想法JNI調(diào)用.運行時執(zhí)行效率高.但要注意從Java層到C層會生成副本.Opengl圖片大