【问题标题】:Android Support Library 22.1 and AlertDialog bug?Android 支持库 22.1 和 AlertDialog 错误?
【发布时间】:2015-07-12 19:35:29
【问题描述】:

我尝试将我的 AlterDialog 更新为新的 android.support.v7.app.AlertDialog,只是更改了:

import android.app.AlertDialog

import android.support.v7.app.AlertDialog

新的 AlertDialogs 现在在 Pre-Lollipop 上显示为 Material 样式,但对话框窗口要宽得多(在平板电脑上测试过)。 这不是错误吗? android.support.v7.app.AlertDialog 的宽度应该与 android.app.AlertDialog 相同吗?

【问题讨论】:

    标签: android material-design android-alertdialog android-appcompat


    【解决方案1】:

    这是一个材质规范。

    但是,您可以自定义此规范,使用自定义主题。例如这样的:

    <style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
           <!-- background, accent color..... -->
    
           <item name="windowMinWidthMajor">30%</item>
           <item name="windowMinWidthMinor">30%</item>
       </style>
    

    【讨论】:

      【解决方案2】:

      Material 设计通常比以前的 Android 设计使用更多的空白和更大的边距/填充,所以不 - 这不是错误。

      它符合此处列出的规格: http://www.google.com/design/spec/components/dialogs.html

      【讨论】:

      • 那么,为什么当我在 Lollipop 设备上使用 android.app.AlertDialog 并在同一个 Lollipop 设备上使用 android.support.v7.app.AlertDialog 时,“android.support.v7.app.AlertDialog “更宽?应该是一样的。为一个小对话框创建一个极宽的窗口。
      猜你喜欢
      • 2015-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-09
      • 2015-02-05
      相关资源
      最近更新 更多