【问题标题】:How to show error message without using Toast [closed]如何在不使用 Toast 的情况下显示错误消息 [关闭]
【发布时间】:2014-12-15 11:33:36
【问题描述】:

我可以通过其他方式显示不使用toast message 的错误消息吗?请帮我? 而且我也不想显示弹出窗口..

【问题讨论】:

标签: android error-handling android-toast


【解决方案1】:

使用动画,点击edittext(如果为空)

    Animation shake = AnimationUtils.loadAnimation(LoginActivity.this,
            R.anim.shake);
    editTextId.startAnimation(shake);

在 res 中创建文件夹动画

添加文件shake.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="0"
android:interpolator="@anim/cycle_7"
android:toXDelta="10" />

文件cycle_7.xml

<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="7" />

【讨论】:

    【解决方案2】:

    使用setError()方法,你可以像edittext.setError("ur message",icon);一样使用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-20
      相关资源
      最近更新 更多