安卓对话框问题
当在 Android 应用程序中使用自定义对话框时,如何才能让用户知道他/她输入了错误的参数,例如错误的密码或用户名?
可能是 AlertDialog 还是只是 Toast_Message?
谢谢
When using a custom dialog in an Android App how is it then possible to let the user know, that he/she has entered a wrong argument, e.g. a wrong password or username?
Possible an AlertDialog or just a Toast_Message?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将文本视图添加到自定义对话框中,如果用户/密码组合失败,您只需显示此文本视图以及所需的消息。
它会比 AlertDialog 更好,连续 2 个对话框对用户不利。而且 toast 消息并不总是能被所有用户理解。
You can add a textview to your customdialog, if the user/password combination fails, you only need to display this textview with the message wanted.
It will be better than AlertDialog, 2 consecutives dialog aren't good for the user. And the toast message are not always understandable for all users.
原则上你可以使用任何你想要的东西。屏幕闪烁,所有 LED 发出所有可能的声音,使手机 R2D2 克隆速度加快。
更严肃地说。可以使用 Toast 通知,但不一定是一个好的选择,因为用户可能没有注意并错过整个通知,导致用户感到困惑,因为他期望应用程序登录 现在有
AlertDialog
通知,它可能是最合适的通知类型,用于通知用户他做了或没有做的重要事情。它需要用户的关注,这正是您在这种情况下想要的。
将会有
StatusBarNotification
,用于显示正在进行的进程。最好的例子是下载或其他东西。另一种选择是出现的
TextView
,它需要足够独特才能容易地被用户注意到,当然必须规划布局以支持这种动态变化。我的建议是
AlertDialog
,如果由于某种原因不适用,则使用动态TextView
。You can use whatever you want in principle. Flash the screen and all LEDs generate all possible sounds to make the phone R2D2s clone on speed.
On a more serious note. A
Toast
notification can be used but is not necessarily a good option since it could happen that the users just does not pay attentions and misses the whole notification resulting in a confused user as he is expecting the application to log him in.Now there is the
AlertDialog
notification which is probably the most suitable notification type to inform a user about something critical he did or didn't. It requires users attention which is exactly what you want in such cases.There would be the
StatusBarNotification
which is meant to display an ongoing process. Best example would be a download or something.Another option would be an appearing
TextView
which needs to be distinctive enough to be easily noticed by the user and of course the layout has to be planned to support such dynamic changes.My recommendation is the
AlertDialog
and if not applicable for some reason then the dynamicTextView
.