我需要有一个对话框,我可以选择一个时间持续时间(30,60,90,120,…秒)。我有两个选择(我不使用旋转器)
-
在Dialog中使用NumberPicker和显示的标签列表如下:
30 Seconds 60 Seconds 90 Seconds 120 Seconds 150 Seconds 180 Seconds ...
-
使用AlertDialog与单一选择(单选按钮将显示在对话框中)
-
我的问题是:
Which kind of Dialog do you recommend?
谢谢!
我会使用对话框,因为这对用户来说是最简单的操作。
但这完全是个人的观点,你应该做对你和你的用户体验最好的事情:)
我会选择AlertDialog,它很容易实现。
AlertDialog dialog = new AlertDialog.Builder(this)
.setView(getLayoutInflater().inflate(R.layout.custom_dialog, null))
.create();
为了监听用户事件
View view = getLayoutInflater().inflate(R.layout.custom_dialog, null);
Button btn = (Button)view.findViewById(R.id.the_id_of_the_button);
btn.setOnClickListener(your listentener);
AlertDialog dialog = new AlertDialog.Builder(this)
.setView(view)
.create();