通天塔

来源:互联网 发布:大唐无双金卡武将数据 编辑:程序博客网 时间:2024/04/28 08:36
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 要使用findViewById, 一定要使用layout / *.xml 做为使用者介面 setContentView( R.layout.main ); // 取得UI 介面中的View 物件 // 取得View 物件后,再透过转换成实际的物件 ImageView iv = (ImageView)this.findViewById(R.id.widget28); // 设定ImageView 的图片来源 iv.setImageResource( R.drawable.icon ); // 动画设定(指定移动动画) (x1, x2, y1, y2) Animation am = new TranslateAnimation ( 10, 230, 10, 400 ); // 动画开始到结束的执行时间(1000 = 1 秒) am. setDuration ( 2000 ); // 动画重复次数(-1 表示一直重复) am. setRepeatCount ( -1 ); // 图片配置动画 iv. setAnimation (am); // 动画开始 am. startNow ();} public void con