
提前致谢
public class CustomVIEw extends ImageVIEw{public CustomVIEw(Context context,AttributeSet attrs,int defStyle) { super(context,attrs,defStyle);}public CustomVIEw(Context context,AttributeSet attrs) { super(context,attrs);}public CustomVIEw(Context context) { super(context);}boolean drawGlow = false;//this is the pixel coordinates of the screenfloat glowX = 0;float glowY = 0;//this is the radius of the circle we are drawingfloat radius = 20;//this is the paint object which specifIEs the color and Alpha level //of the circle we drawPaint paint = new Paint();{ paint.setAntiAlias(true); paint.setcolor(color.WHITE); paint.setAlpha(50);};@OverrIDepublic voID draw(Canvas canvas){ super.draw(canvas); if(drawGlow) canvas.drawCircle(glowX,glowY,radius,paint);}@OverrIDepublic boolean ontouchEvent(MotionEvent event){ if(event.getAction() == MotionEvent.ACTION_DOWN){ drawGlow = true; }else if(event.getAction() == MotionEvent.ACTION_UP) drawGlow = false; glowX = event.getX(); glowY = event.getY(); this.invalIDate(); return true;}} 这段代码是我希望动画的触摸事件
解决方法 对于发光效果检查 Glow effect和对于闪烁类型的动画使用它,你必须改变Reapeatcount和持续时间根据您的要求
AlphaAnimation b@R_419_6862@animation= new AlphaAnimation(1,0); // Change Alpha from fully visible to invisibleb@R_419_6862@animation.setDuration(300); // duration - half a secondb@R_419_6862@animation.setInterpolator(new linearInterpolator()); // do not alter animation rateb@R_419_6862@animation.setRepeatCount(3); // Repeat animation infinitelyb@R_419_6862@animation.setRepeatMode(Animation.REVERSE);
使用后如下所示
imagevIEw.startAnimation(b@R_419_6862@animation); or imagevIEw.setAnimation(b@R_419_6862@animation);总结
以上是内存溢出为你收集整理的androidview动画发光效果在imageview上全部内容,希望文章能够帮你解决androidview动画发光效果在imageview上所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)