标签:android view XML star version 1.0 start text 输入框
shake.xml <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromXDelta="0" android:interpolator="@anim/cycle_8" android:toXDelta="10" /> cycle_8.xml <?xml version="1.0" encoding="utf-8"?> <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="8" />
public void login(View v) { //得到输入框的文本 String name = et_main_name.getText().toString(); //判断是否是空串, 如果为空串, 显示抖动动画 if("".equals(name.trim())) { Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake); et_main_name.startAnimation(animation); } else { //否则, 提示登陆 Toast.makeText(this, "去登陆", 0).show(); } }
标签:android view XML star version 1.0 start text 输入框
原文地址:https://www.cnblogs.com/znsongshu/p/9365369.html