大佬教程收集整理的这篇文章主要介绍了android – 自定义对话框大小匹配Theme.Holo.Light.Dialog,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
它不会崩溃以匹配标题的宽度,如果您有通过扩展Dialog类的类拥有自己的Dialog构建将会发生什么.
这是我的布局会发生什么.
什么属性我需要应用于LinearLayout使它变得漂亮?
从文档:
使用它的方法是通过将ContextThemeWrapper代替到您的自定义Dialog的构造函数的Context(使用这个):
YourCustomDialog cDialog = new YourCustomDialog( new ContextThemeWrapper(this,android.R.style.Theme_Holo_Light_Dialog_MinWidth));
这是如何定义Theme.Holo.Light.Dialog.MinWidth:
<style name="Theme.Holo.Light.Dialog.MinWidth"> <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item> <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item> </style>
来自dimensions.xml:
@android:扪/ dialog_min_width_major:
<!-- The platform's desired minimum size for a dialog's width when it is along the major axis (that is the screen is landscapE). This may be either a fraction or a dimension. --> <item type="dimen" name="dialog_min_width_major">65%</item>
@android:扪/ dialog_min_width_minor:
<!-- The platform's desired minimum size for a dialog's width when it is along the minor axis (that is the screen is porTrait). This may be either a fraction or a dimension. --> <item type="dimen" name="dialog_min_width_minor">95%</item>
看起来,您发布的图片中的对话框的宽度大约为65%.在肖像模式下,这将是95%.
老实说,在纵向模式下,宽度看起来不像95%,但是比以前更好:):
以上是大佬教程为你收集整理的android – 自定义对话框大小匹配Theme.Holo.Light.Dialog全部内容,希望文章能够帮你解决android – 自定义对话框大小匹配Theme.Holo.Light.Dialog所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。