手机版
你好,游客 登录 注册
背景:
阅读新闻

Android抖动的输入框

[日期:2012-07-20] 来源:Linux社区  作者:android_xiaoqi [字体:大 中 小]

Android抖动的输入框

Java代码:启动动画

  1. Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);  
  2.         findViewById(R.id.pw).startAnimation(shake);  

anim/shake.xml

  1. <translate xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     android:duration="5000"  
  3.     android:fromXDelta="0"  
  4.     android:interpolator="@anim/cycle_7"  
  5.     android:toXDelta="10" />  

duration为抖动时间,fromXDelta,toXDelta抖动幅度

anim/cycle_7.xml

  1. <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     android:cycles="50" />  

main.xml

  1. <EditText android:id="@+id/pw"  
  2.         android:layout_width="match_parent"  
  3.         android:layout_height="wrap_content"  
  4.         android:layout_margin="50dip"  
  5.         android:clickable="true"  
  6.         android:singleLine="true"  
  7.         android:password="true"  
  8.     />  
linux
相关资讯       Android编程入门 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款