Fra*_*ran 1 android android-appcompat android-alertdialog material-design
我试图将我的AlterDialog更新为新的android.support.v7.app.AlertDialog,只需更改:
import android.app.AlertDialog
Run Code Online (Sandbox Code Playgroud)
至
import android.support.v7.app.AlertDialog
Run Code Online (Sandbox Code Playgroud)
新的AlertDialogs现在在Pre-Lollipop上显示为Material样式,但对话窗口更宽(在Tablet上测试).这不是一个错误吗?应该是android.support.v7.app.AlertDialog与android.app.AlertDialog相同的宽度?
它是材料规格.
但是,您可以自定义此规范,使用自定义主题.例如这样的事情:
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- background, accent color..... -->
<item name="windowMinWidthMajor">30%</item>
<item name="windowMinWidthMinor">30%</item>
</style>
Run Code Online (Sandbox Code Playgroud)