windowMinWidthMajor和android:windowMinWidthMajor有什么区别 [英] What is the difference between windowMinWidthMajor and android:windowMinWidthMajor

查看:283
本文介绍了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:windowMinWidthMajor do the trick?

推荐答案

根据 Min_witdh_major是:

Min_witdh_major is:

当对话框沿主轴(即屏幕为横向)时,该对话框的宽度所需的平台最小尺寸.这可以是分数,也可以是维度.

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.

min_with_minor是:

And min_with_minor is:

当对话框沿短轴(即屏幕为纵向)时,该对话框的宽度所需的平台最小尺寸.这可以是分数,也可以是维度.

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.

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

In appcompat, this value is set as 65%.

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

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