imageView = (ImageView) findViewById(R.id.btn_border);
int bmpW = BitmapFactory.decodeResource(getResources(),
R.drawable.talk_border).getWidth();// 获取图片宽度
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screenW = dm.widthPixels;// 获取分辨率宽度
int offset = screenW / 4 - bmpW;// 计算偏移量
Matrix matrix = new Matrix();
matrix.postTranslate(offset, 0);
imageView.setImageMatrix(matrix);// 设置动画初始位置
AnimationSet AnimationSet = new AnimationSet(true);
TranslateAnimation TranslateAnimation;
TranslateAnimation = new TranslateAnimation(0, screenW / 4, 0f, 0f);//(动画移动位置{起始位置,结束位置,0f,0f})
AnimationSet.addAnimation(TranslateAnimation);
AnimationSet.setFillBefore(false);
AnimationSet.setFillAfter(true);
AnimationSet.setDuration(100);
imageView.startAnimation(AnimationSet);