对于活动AlertDialog式按键 [英] AlertDialog style buttons for an Activity

查看:120
本文介绍了对于活动AlertDialog式按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个保存的活动和取消按钮的下方。

I have an activity with a Save and Cancel button at the bottom.

在AlertDialog,该按钮显示了某种风格的容器视图中。

In AlertDialog, the buttons are displayed inside a styled container view of some sort.

我怎么能放弃我的活动同样外观的按钮?具体来说,我怎么能申请在AlertDialog按钮容器以说,在含有按钮我的活动一的LinearLayout的风格?

How could I give the buttons in my Activity that same appearance? Specifically, how could I apply the style of the button container view in the AlertDialog to say a LinearLayout in my Activity containing the buttons?

感谢

推荐答案

我做一些事情是这样的:

I do some thing like this:

LinearLayout dialogLayout = (LinearLayout) ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.dialog_addeditrecord, null);

我然后使用dialogLayout调用findViewById()拉中的按钮和其他视图和设置OnClickListeners和这样的...

I then use the dialogLayout to call findViewById() to pull in the buttons and other views and setup OnClickListeners and such...

然后显示的对话框:

builder = new AlertDialog.Builder(this);

builder.setView(dialogLayout);

builder.create().show();

这篇关于对于活动AlertDialog式按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆