定位确定/取消按钮,让他们模仿对话布局 [英] Positioning OK/Cancel buttons so that they mimic the layout in dialogs

查看:85
本文介绍了定位确定/取消按钮,让他们模仿对话布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们当中有些人可能已经注意到,Android的改变的顺序确定/取消按钮ICS后显示在对话框中(见的这个问题)。这种变化可能是有意义的,我不是在争夺它。我的问题是,怎么你们处理的同时支持新的应用程序 主题(因为操作栏)和原生态的主题?我们怎样才能调和我们的布局顺序,在该对话框的命令?

As some of you might have noticed, Android changed the order in which the OK/Cancel buttons are displayed in dialogs after ICS (see this issue). The change might make sense, I'm not contesting it. My question is, how are you guys dealing with applications that support both the new theme (because of the action bar) and the "original" theme? How can we reconcile the order in our layouts with the order in the Dialog?

我试图寻找到对话框code,但它没有做什么特别的东西,订单在布局文件(这是风格不同的全息)确定的。有没有人创建考虑到这一点片段或小工具?

I tried looking into the dialog code, but it's not doing anything special, the order is determined in the layout files (which is styled different for Holo). Has anyone created a fragment or widget that takes this into account?

推荐答案

您可以把替代布局布局-V14 与定位为ICS的按钮。事实上,这正是皮棉会建议你做的,当你在你的项目运行它。报价:

You can put an alternative layout in layout-v14 with the buttons positioned as in ICS. In fact, that is what lint will advise you to do when you run it on your project. Quote:

布局使用了错误的按键顺序API> = 14:创建   布局-V14 / layout.xml文件相反的顺序:OK按钮应该是   正确的(是OK |取消,应该是取消| OK)

Layout uses the wrong button order for API >= 14: Create a layout-v14/layout.xml file with opposite order: OK button should be on the right (was "OK | Cancel", should be "Cancel | OK")

您可以使用DialogFragment与自定义布局创建对话框。

You can use DialogFragment to create dialogs with custom layouts.

这篇关于定位确定/取消按钮,让他们模仿对话布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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