Van*_*nel 6 android dialog android-2.2-froyo android-alertdialog
我正在开发一个Android 2.2应用程序.
我想显示一个带有Ok butto的文本,但我想添加我的自定义样式.
使用自定义布局或对话框的AlertDialog有什么更好的选择?
Cri*_*ian 29
我会去AlertDialog:
AlertDialog dialog = new AlertDialog.Builder(this)
.setView(getLayoutInflater().inflate(R.layout.custom_dialog, null))
.create();
Run Code Online (Sandbox Code Playgroud)
为了侦听UI事件:
View view = getLayoutInflater().inflate(R.layout.custom_dialog, null);
Button btn = (Button)view.findViewById(R.id.the_id_of_the_button);
btn.setOnClickListener(blah blah);
AlertDialog dialog = new AlertDialog.Builder(this)
.setView(view)
.create();
Run Code Online (Sandbox Code Playgroud)
您可以登录android对话框文档:
Dialog类是对话框的基类,但您应该避免直接实例化Dialog.而是使用以下子类之一:
| 归档时间: |
|
| 查看次数: |
11683 次 |
| 最近记录: |