public void MyAlertFinger( ) {
View vi;
TextView tvs;
final AlertDialog builder = new AlertDialog.Builder(
MainActivity.this).create();
if (!builder.isShowing()) {
builder.show();
}
builder.setView(null, 0, 0, 0, 0);
vi = (MainActivity.this).getLayoutInflater().inflate(
R.layout.alert, null);
tvs = (TextView) vi.findViewById(R.id.tv);
builder.setContentView(vi);//----对话框的view被设置成为vi了
builder.getWindow().setLayout(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
//初始化
Animation translateAnimation = new TranslateAnimation(0.1f, 100.0f,0.1f,150.0f);
translateAnimation.setRepeatCount(2);
//设置动画时间
translateAnimation.setDuration(1000);
tvs.startAnimation(translateAnimation);
vi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
builder.dismiss();
}
});
}