windowMinWidthMajor和android

windowMinWidthMajor和android

本文介绍了windowMinWidthMajor和android:windowMinWidthMajor有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想为我的ProgressDialog设置适当的样式.我喜欢默认的,但我想对其进行自定义.我尝试使用AppCompat对话框,但是它们都为我的对话框设置了奇怪的宽度和高度.

I want to set up a proper style for my ProgressDialog.I like the default one but I want to customize it. I've tried to use AppCompat dialogs but they all setup some weird width and height for my Dialog.

我发现从MaterialDialog扩展可以解决问题,因此这段代码可以工作:

I found that extending from MaterialDialog do the trick, so this code works:

<style name="ProgressDialogTheme" parent="MaterialBaseTheme.AlertDialog" >
</style>

这是因为MeterialDialog本身设置了自定义宽度

This is because MeterialDialog itself setup custom width

<style name="MaterialBaseTheme.AlertDialog" parent="MaterialBaseTheme.Dialog">
        <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
        <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
    </style>

我发现有一个AppCompat对话框,它设置了相同的自定义宽度,这里是:

And I found that there is AppCompat dialog that set up the same custom width, here it is:

<style name="Base.Theme.AppCompat.Light.Dialog.Alert">
        <item name="windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
        <item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
    </style>

但不起作用

唯一的区别是MeterialDialog属性开头的 andorid名称空间.

The only difference is a andorid namespace at the beginning of MeterialDialog attribute.

有人可以解释为什么 android:windowMinWidthMajor 有用吗?

Can someone explain why android:windowMinWidthMajordo the trick?

推荐答案

根据此链接:

Min_witdh_major是:

Min_witdh_major is:

min_with_minor是:

And min_with_minor is:

在appcompat中,此值设置为65%.

In appcompat, this value is set as 65%.

这篇关于windowMinWidthMajor和android:windowMinWidthMajor有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:10