1、自定义style
2、使用方法:
1 buttonWhat.setOnClickListener(new OnClickListener() { 2 3 @Override 4 public void onClick(View v) { 5 // TODO Auto-generated method stub 6 Dialog dialog = new Dialog(activate.this, R.style.ShakeDialog); 7 8 // Setting the title and layout for the dialog 9 TextView tv = new TextView(ctxt); 10 tv.setTextSize(20f); 11 tv.setText("授权码由?写的英?文字?母组成(A-Z)"); 12 13 dialog.setContentView(tv); 14 dialog.show(); 15 } 16 });
3、抖动效果(抖动4次)xml文件如下:
shake.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="-10" android:interpolator="@anim/cycle_4" android:toXDelta="10" />
cycle4.xml
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="4" />
原文:http://www.cnblogs.com/kunyashaw/p/4348814.html