WEB开发网
开发学院手机开发Android 开发 Android 小项目之--消息、线程、动画显示图片 阅读

Android 小项目之--消息、线程、动画显示图片

 2010-06-04 14:29:00 来源:WEB开发网   
核心提示:@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);myImageView=(ImageView)findViewById(R

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

myImageView=(ImageView)findViewById(R.id.ImageView01);

myAnimationAlpha=new AlphaAnimation(0.1f, 1.0f);

myAnimationAlpha.setDuration(3000);

myAnimationScale=new ScaleAnimation(0.0f, 1.4f, 0.0f, 1.4f,

Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

myAnimationScale.setDuration(3000);

myAnimationTranslate=new TranslateAnimation(30.0f, -80.0f, 30.0f, 300.0f);

myAnimationTranslate.setDuration(3000);

myAnimationRotate=new RotateAnimation(0.0f, +350.0f,

Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF, 0.5f);

myAnimationRotate.setDuration(3000);

// myLinearLayout.setBackgroundColor(Color.WHITE);

myHandler=new Handler()

{

@Override

public void handleMessage(Message msg) {

// TODO Auto-generated method stub

switch (msg.what) {

case testHandler.my_key:

switch (a) {

case 0:

myImageView.startAnimation(myAnimationAlpha);

break;

case 1:

myImageView.startAnimation(myAnimationScale);

break;

case 2:

myImageView.startAnimation(myAnimationTranslate);

break;

case 3:

myImageView.startAnimation(myAnimationRotate);

break;

default:

break;

}

myImageView.setImageResource(myImage[a-1]);

myImageView.setScaleType(ImageView.ScaleType.FIT_XY);

//myImageView.setLayoutParams(new LayoutParams(300, 200));

if(a==myImage.length)

{

a=0;

}

break;

default:

break;

}

上一页  1 2 3 4  下一页

Tags:Android 项目 消息

编辑录入:coldstar [复制链接] [打 印]
赞助商链接